Re: Gdb and stopping at assert or segmentation faults
Hi all Dave Korn dave.korn at artimi.com writes: Anyway, break __assert works for catching the assertions. Dunno what's up with the SEGVs. well, it turns out Dave's suggestion doesn't work anymore on latest cygwin (tested this only with C++ programs): GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special) gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) In fact, it will now break before entering main(), but not when the assert is called. Using break __assert says (gdb) break __assert Breakpoint 1 at 0x4ac3e6: file /usr/lib/gcc/i686-pc- cygwin/3.4.4/include/c++/iostream, line 77. (gdb) r Starting program: /home/kris/MyDocuments/mytest.exe Breakpoint 1, __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/iostream:77 (gdb) c assertion overlap-epsilon failed: file ./include/stir/numerics/overlap_interpolate.inl, line 108 Program exited normally. Any other suggestions? Thanks Kris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Gdb and stopping at assert or segmentation faults
Dave Korn dave.korn at artimi.com writes: Anyway, break __assert works for catching the assertions. Dunno what's up with the SEGVs. Hi Dave I thought this would break even when the assertion didn't fail, but I was wrong there! Good suggestion! Thanks Kris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Gdb and stopping at assert or segmentation faults
Kris Thielemans wrote: I need to debug a program that throws up an assert(). On Linux, I'm used to be able to run the program in gdb, and when the assert happens, the program stops (in the assert function) and I can do a back trace (e.g. info stack). On cygwin on the other hand, I just get the assert message, and then gdb says Program exited normally. No backtrace possible. The same difference in behaviour between Linux and cygwin with segmentation faults. It would be incredibly useful to be able to see where the segmentation fault happened after the crash. You need to set the 'error_start' parameter of the CYGWIN environment variable to the (windows) path of gdb. You can also call cygwin_internal (CW_DEBUG_SELF, c:\\path\\to\\gdb.exe) in your code to force a fault. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Gdb and stopping at assert or segmentation faults
Hi Brian You need to set the 'error_start' parameter of the CYGWIN environment variable to the (windows) path of gdb. I think what you're saying is that if I do this, it will launch gdb on the crash? Ok. However, what I was saying is that I would like to be able to backtrace when I launch a program from within gdb: Gdb myprog Run assert or segmentation fault Info stack You can also call cygwin_internal (CW_DEBUG_SELF, c:\\path\\to\\gdb.exe) in your code to force a fault. Ok. That's useful as well. Thanks! Kris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Gdb and stopping at assert or segmentation faults
Original Message From: Kris Thielemans Sent: 29 June 2005 17:24 However, what I was saying is that I would like to be able to backtrace when I launch a program from within gdb: Gdb myprog Run assert or segmentation fault Info stack Odd, I would have thought this should work. Anyway, break __assert works for catching the assertions. Dunno what's up with the SEGVs. cheers, DaveK -- Can't think of a witty .sigline today -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/