From: hfernandes AT geocities DOT com (Fernandes, Hilton) Subject: Re: Debugging help needed 9 Nov 1997 23:56:36 -0800 Message-ID: <199711100736.XAA21828.cygnus.gnu-win32@geocities.com> References: <199711091821 DOT NAA10228 AT p2 DOT acadia DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT To: "Scott Warner" , gnu-win32 AT cygnus DOT com Cc: "Fernandes, Hilton" 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 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 hfernandes AT geocities DOT com 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 "gnu-win32-request AT cygnus DOT com" with one line of text: "help".