Subject: Re: Debugging help needed
From: [email-masked] (Fernandes, Hilton)

9 Nov 1997 23:56:36 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7BIT
To: "Scott Warner" <[email-masked]>, [email-masked]
Cc: "Fernandes, Hilton" <[email-masked]>

On  9 Nov 97 at 13:16, Scott Warner <[email-masked]> wrote:

> I am writing a theorem generator.  In the function that asks for your
> theorem the program seems to crash.  The code is:
> 
> 	cout << "\nEnter your theorem : ";
> 
> 	cin.getline(m_str, sizeof(m_str)-1);
> 
> m_str is a class member of a predetermined size.  Here is the DOS window
> output after it crashes:
 
<snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip><snip>

> It goes on to list a detailed stack trace.  Two questions:  why does it
> crash?  cin.getline is used correctly.  Is it out of stack space?  I do not
> allocate m_str using new, just char m_str[MAX_BUF], where MAX_BUF is 120.
> 
> Third:  does a debugger come with gun-win32?  I have used Codeview several
> times.
> 

Third :-) There is a debugger in cygwin32, a. k. a. gnu-win32.  It is called
gdb and is the standard GNU debugger.  In cygwin it has a GUI face, but the
same commands.  It is very useful -- particularly in cases like yours --, but
it still demands some finishing touches.  Get acquainted with it through the 
"help" command, typed at the user prompt.

First and second :-) Usually the cygwin products work, even when need
finishing touches.   So, the first thing to check is your use of <iostream.h>
classes.  My personal experience with it was not very good.  I hope yours is
better. :-)

Run your program through gdb and it will show the line where it broke.  Then a 
command named "where" will display the stack of functions when the program 
broke.

Don't forget to compile and link with the -g flag enabled.

Best regards,
++Hilton
----
Hilton Fernandes
[email-masked]
http://www.geocities.com/SiliconValley/Lakes/5657
URLs and help on C++ programming and Object-Oriented Design
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".