delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/05/08:37:55

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_83,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A50A18B.6070407@gmail.com>
Date: Sun, 05 Jul 2009 13:50:19 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Segmentation fault when exception is thrown or assertion fails [g++/gcc]
References: <a15a61310907042018t40f47459m6054bb3772ff62d5 AT mail DOT gmail DOT com> <a15a61310907042043m63b85017kcae8f9362b5fafee AT mail DOT gmail DOT com>
In-Reply-To: <a15a61310907042043m63b85017kcae8f9362b5fafee@mail.gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Roman Werpachowski wrote:
> Some more details about my problem
> (http://cygwin.com/ml/cygwin/2009-07/msg00150.html)
> 
> $ gcc -v

  Actually even more useful would be to know what Cygwin DLL version you're
running.  The problems page that CGF directed you to contains in particular
the advice to run "cygcheck -s -v -r > cygcheck.out" and then send the
cygcheck.out file ** as an attachment, not inline, please ** to the list with
your post.

  From your earlier post:

> I understand that Cygwin defaults to dumping the stack trace, but why
> the message about segmentation fault? It confuses the hell out of me.

  Well, what happened was that there's a bug somewhere, and while cygwin was
in the process of dumping the stack trace for the abort caused by your
assertion firing, the DLL itself had a segfault, and had to give up.  It said
"probably corrupted stack", because that's the most common reason why you
might end up following a stray pointer and causing a segfault when you were
trying to unwind the stack, but in this case it's unlikely anything would have
corrupted the stack, so either there's a real bug or perhaps just some kind of
frame-pointer optimisation that confuses the unwind routine.

  I tried your example with both gcc-4 and gcc-3 on current 1.7 and it worked
just fine:

> $ cat ass.c
> #include <assert.h>
> 
> int main(void)
> {
>     assert( 1 == 0 );
>     return 0;
> }
> 
> $ gcc -g -O0 ass.c -o ass
> 
> $ ./ass.exe
> assertion "1 == 0" failed: file "ass.c", line 5, function: main
> Aborted (core dumped)
> 
> $ ls
> ass.c  ass.exe  ass.exe.stackdump
> 
> $ cat ass.exe.stackdump
> Stack trace:
> Frame     Function  Args
> 0022CAF8  7C4F1B1B  (00000000, FFFFFFFF, 0022CC28, 00000000)
> 0022CBD8  610B5527  (00000000, 00000000, 00000000, 00000000)
> 0022CC28  610B593B  (00000634, 0022CC50, 77F891D2, 000003D0)
> 0022CCE8  610B5A61  (00000634, 00000006, 0022CD18, 610B5B05)
> 0022CCF8  610B5A9C  (00000006, 0022CE88, 6115444C, 00000101)
> 0022CD18  610B5B05  (61158054, 00402085, 0040208C, 00000005)
> 0022CD48  6100109B  (0040208C, 00000005, 00402080, 00402085)
> 0022CD68  610B2CB8  (6127EE7E, 00000000, 0022CDA8, 61006E4A)
> 0022CDA8  61006E4A  (00000000, 0022CDE0, 61006720, 7FFDF000)
> End of stack trace

  I also tried at -O2, same results.

    cheers,
      DaveK


--
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019