gdb on cygwin and debugging assert() or program segmentation faults

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Wed Jul 20 02:37:00 GMT 2005


On Tue, Jul 19, 2005 at 07:13:17PM -0700, Brian Dessent wrote:
>Kris Thielemans wrote:
>
>> I need to debug a C++ 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.
>
>Set the error_start parameter of the CYGWIN variable to gdb and then run
>the program, and you should gdb launched and attached to the process
>when it encounters a SEGV or abort().  See the users manual section
>about $CYGWIN.

And, FWIW, gdb *does* do the right thing (i.e., the same thing as any
UNIX system) when the program generates a genuine SIGSEGV.  It just
doesn't do anything for cygwin-specific signals like SIGABRT.  It
also won't stop if you do something like "kill (getpid (), SIGSEGV)" since
that just sends a "cygwin signal".

cgf



More information about the Gdb mailing list