X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: cygwin AT cygwin DOT com Subject: 1.5 unused error_start logic causes segfaults? Date: Tue, 20 Oct 2009 09:02:06 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Matthias Andree" Message-ID: User-Agent: Opera Mail/10.00 (Win32) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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