2 Feb 2006 13:26
[patch] fix spurious SIGSEGV faults under Cygwin
Brian Dessent <brian <at> dessent.net>
2006-02-02 12:26:14 GMT
2006-02-02 12:26:14 GMT
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 <string>
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
(Continue reading)
RSS Feed