Recently Cygwin has changed the way that it internally checks arguments for bad pointers. Where before it used IsBad{Read,Write}Ptr() from the win32 API, now it installs its own temporary SEH fault handler. However, gdb is not aware of this and so it leads to the program stopping on a SIGSEGV on perfectly legitimate code -- when not run under the debugger, Cygwin's fault handler catches the attempt and returns the appropriate error. Here is a minimal example: $ cat ss.cc #include int main() { std::string foo; return 0; } $ g++ -g ss.cc -o ss $ gdb --quiet ./ss (gdb) r Starting program: /tmp/false_sigsegv/ss.exe Program received signal SIGSEGV, Segmentation fault. 0x610af8b8 in pthread_key_create (key=0x482c08, destructor=0) at /usr/src/sourceware/winsup/cygwin/thread.cc:129 129 if ((*object)->magic != magic) (gdb) c Continuing. Program exited normally. (gdb) Here pthread_key_create() was simply checking to see if 'key' happened to be a previously-initiaized object, which in most cases is not true, and so the fault is expected and handled. However, it's very inconvenient and unintuitive that gdb still stops the program, and it makes the user think there is something wrong with his program and/or the Cygwin library. The attached patch adds a very simple mechanism by which the Cygwin program shall signal to gdb that it has temporarily installed its own fault handler for EXCEPTION_ACCESS_VIOLATION, so that gdb can deal with this more gracefully by ignoring these faults. This uses the existing WriteDebugString() mechanism that Cygwin already uses to communicate to the debugger, but just extends it by defining two new "magic" string values. I've split the patch into two parts since it requires changes to both cygwin and gdb. Brian winsup/cygwin: 2006-02-02 Brian Dessent * cygtls.h: Include sys/cygwin.h. (myfault::~myfault): If a debugger is present, inform it that our fault handler has been removed. (myfault::faulted): Likewise for when the fault handler is installed. * include/sys/cygwin.h (_CYGWIN_FAULT_IGNORE_STRING): Add define. (_CYGWIN_FAULT_NOIGNORE_STRING): Ditto. gdb: 2006-02-02 Brian Dessent * win32-nat.c (_CYGWIN_SIGNAL_STRING): Remove duplicated definition. (ignoring_faults): Define new static global. (handle_output_debug_string): Check for fault ignore/noignore signals from the inferior. (handle_exception): Do not process the fault if 'ignoring_faults' is set. (do_initial_win32_stuff): Initialize 'ignoring_faults'.