public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Debugging help needed
@ 1997-11-10 21:28 Scott Warner
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Warner @ 1997-11-10 21:28 UTC (permalink / raw)
  To: tage.westlund; +Cc: gnu-win32

Thanks!  I appreciate your help.  It seems that the problem is a binary
file access problem.

----------
> From: Tage Westlund <tage.westlund@stockholm.mail.telia.com>
> To: Scott Warner <swarnerx3@acadia.net>
> Subject: Re: Debugging help needed
> Date: Monday, November 10, 1997 9:36 AM
> 
> Scott Warner wrote:
> >  The code is: 
> >         cout << "\nEnter your theorem : ";
> >         cin.getline(m_str, sizeof(m_str)-1);
> > 
> To Scott!
> 
> I am sitting at the computer to train my rusty C++ fingers. So I 
> coded:
> =========================================
> #include <iostream.h>
> #include <fstream.h>
> 
> main(){
> 	char m_str[120];
> 
> 	cout << "\nEnter your theorem : ";
> 	cin.getline(m_str,sizeof(m_str)-1);
> 	cout << "Repeat: " << m_str << "\n";
> }
> ===========================
> and run:
> bash$ g++ -o test test1.cpp            no error
> bash$ g++ -Wall -o test test1.cpp      no error for "many messages"
> bash$ test.exe
> 
> Enter your theorem : asdfg
> Repeat: asdfg
> bash$
> ===========================
> My system is Win95 and gnu-win32 b18 and a very old Sergey patch.
> My  autoexec.bat  is
> ===========================
> SET GCC_EXEC_PREFIX=C:\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\
> PATH .;C:\gnuwin32\b18\H-i386-cygwin32\bin;C:\gnuwin32\b18\tcl\bin
> SET TMPDIR=C:\WINDOWS\TEMP
> SET C_INCLUDE_PATH=C:\gnuwin32\b18\H-i386-cygwin32\i386-cygwin32\include
> SET CPLUS_INCLUDE_PATH=C:\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\ (N)
> 			i386-cygwin32\cygnus-2.7.2-970404\include; (N)
> 					C:\gnuwin32\b18\include\g++
> SET LIBRARY_PATH=C:\gnuwin32\b18\H-i386-cygwin32\bin; (N)
> C:\gnuwin32\b18\H-i386-cygwin32\i386-cygwin32\bin
> SET HOME=C:\usr\home
> SET TCL_LIBRARY=C:/gnuwin32/b18/tcl/lib/tc17.6
> SET GDBTK_LIBRARY=C:/gnuwin32/b18/share/gdbtcl
>    (N) denotes an added new line in the mail for clarity
> ================================
> Best Regards!
> 
> Tage
> 
> 
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging help needed
@ 1997-11-10 21:28 Scott Warner
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Warner @ 1997-11-10 21:28 UTC (permalink / raw)
  To: Fernandes, Hilton; +Cc: gnu-win32

Thank you for your help.  I compiled & linked with -g, but get a message
from gdb saying 'no debugging symbols found' or to that effect.  However,
this is probably something simple I can take care of with a little
homework.

> 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.
> 
> 

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging help needed
  1997-11-09 10:22 Scott Warner
@ 1997-11-09 23:40 ` Fernandes, Hilton
  0 siblings, 0 replies; 4+ messages in thread
From: Fernandes, Hilton @ 1997-11-09 23:40 UTC (permalink / raw)
  To: Scott Warner, gnu-win32; +Cc: Fernandes, Hilton

On  9 Nov 97 at 13:16, Scott Warner <swarnerx3@acadia.net> 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
hfernandes@geocities.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@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Debugging help needed
@ 1997-11-09 10:22 Scott Warner
  1997-11-09 23:40 ` Fernandes, Hilton
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Warner @ 1997-11-09 10:22 UTC (permalink / raw)
  To: gnu-win32

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:

Enter your theorem : (D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) In
cygwin_except_handler
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) Exception trapped!
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) exception C0000005 at 406D09
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) exception: ax 0 bx 254F2C0 cx
4690004 dx 50
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) exception: si 4 di 1000B8B3 bp
254F0EC sp 254F0E4
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) exception is:
STATUS_ACCESS_VIOLATION
(D:\GNUWIN32\SOURCE\GODEL\GODEL.EXE 1000) Stack trace:

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.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-11-10 21:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-10 21:28 Debugging help needed Scott Warner
  -- strict thread matches above, loose matches on Subject: below --
1997-11-10 21:28 Scott Warner
1997-11-09 10:22 Scott Warner
1997-11-09 23:40 ` Fernandes, Hilton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).