Mail Archives: cygwin/2009/10/20/03:02:29
Greetings,
the following programs will segfault on Cygwin 1.5 with GCC 3.4.4 and GCC
4.3.2 UNLESS I define error_start program in $CYGWIN to contain
error_start=C:\cygwin\bin\dumper.exe. If error_start is defined, the
programs will abort as expected. With CYGWIN unset, the programs segfault.
The first will abort() properly on Cygwin 1.7/GCC 4.3.4 regardless of
whether error_start is defined or not.
What has dumper or error_start got to do with crashes under Cygwin 1.5?
Particularly, why does using dumper.exe "fix" the signal that the program
receives when it doesn't catch the exception?
Any hopes of this getting fixed in Cygwin 1.5? Programs below.
Program 1 (C++):
// try-except.cc
// compile: g++-4 -Wall -W -O -o try-except try-except.cc
// or: g++ -Wall -W -O -o try-except try-except.cc
int main() { throw("bad things happen"); }
Program 2 (C):
// try-abort.c
// compile: gcc-4 -Wall -W -O -o try-abort try-abort.c
// or: gcc -Wall -W -O -o try-abort try-abort.c
#include <stdlib.h>
int main(void) { abort(); }
Now note the "Segmentation fault" vs. "Aborted" below:
$ unset CYGWIN
$ ./try-except.exe
Segmentation fault (core dumped)
$ ./try-abort.exe
Segmentation fault (core dumped)
$ export CYGWIN='error_start=c:\cygwin\bin\dumper.exe'
$ ./try-except.exe
*** starting debugger for pid 2680, tid 1464
*** continuing pid 2680 from debugger call (1)
Aborted (core dumped)
$ ./try-abort.exe
*** starting debugger for pid 2900, tid 5796
*** continuing pid 2900 from debugger call (1)
Aborted (core dumped)
Oh, and let's try to set error_start to something that isn't an executable
program:
$ export CYGWIN='error_start=C:\'
$ ./try-except.exe
terminate called after throwing an instance of 'char const*'
*** starting debugger for pid 5688, tid 3752
7 [sig] try-except 5112 try_to_debug: Failed to start debugger,
Win32 error 3
*** continuing pid 5688 from debugger call (0)
Segmentation fault (core dumped)
Might the error_start logic be broken on Cygwin 1.5, meaning that any
signal causing program termination runs bad code in the Cygwin DLL? This
bad code appears to cause a segfault instead of the original signal unless
a debugger can properly attach.
$ uname -r
1.5.25(0.156/4/2)
On Windows XP Version 2002 Tablet PC Edition 2005 Service Pack 3.
--
Matthias Andree
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -