This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Debugging help needed

On  9 Nov 97 at 13:16, Scott Warner <> 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:

> 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 

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

Best regards,
Hilton Fernandes
URLs and help on C++ programming and Object-Oriented Design
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]