public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: program exit code, "at exit" handler and explicit close of shared objects
Date: Tue, 29 Oct 2019 15:31:00 -0000	[thread overview]
Message-ID: <1805e95e-6733-7a73-56fe-8493389ae367@cornell.edu> (raw)
In-Reply-To: <20754eea-2b5e-dbbb-6027-2643be062e41@cornell.edu>

On 10/29/2019 10:53 AM, Ken Brown wrote:
> On 10/26/2019 11:07 AM, Roumen Petrov wrote:
>>
>> After additional tests (research) I was able to isolate issues to simple test
>> case. Please find attached "test-dlclose.c" and "Makefile".
>> First test is as is:
>>
>> $ make
>> cc -g -Wall -Wextra    test-dlclose.c   -o test-dlclose
>> ./test-dlclose
>> exit with code 33
>> make: [Makefile:4: all] Error 33 (ignored)
>>
>> For next test change test-dlclose.c to define DLCLOSE_ATEXIT ( s/#if 0/#if 1/ ):
>> $ make
>> cc -g -Wall -Wextra    test-dlclose.c   -o test-dlclose
>> ./test-dlclose
>> exit with code 33
> 
> I ran this second version of test-dlclose (with DLCLOSE_ATEXIT defined) under
> strace and got the following:
> 
> $ strace -o trace.out ./test-dlclose.exe
> exit with code 33
> Segmentation fault
> 
> The strace output ends with
> 
>      30   30143 [main] test-dlclose 847 write: 18 = write(1, 0x600061E20, 18)
> --- Process 33456 (pid: 847) unloaded DLL at 00000003e7930000
> --- Process 33456 (pid: 847), exception c0000005 at 00000003e7931080
> --- Process 33456 (pid: 847) thread 26088 exited with status 0xc0000005
> --- Process 33456 (pid: 847) thread 33544 exited with status 0xc0000005
> --- Process 33456 (pid: 847) thread 36020 exited with status 0xc0000005
> --- Process 33456 exited with status 0xc0000005
> 
> The address 00000003e7930000 seems to be in /usr/bin/cygz.dll, which is the DLL

Sorry, I meant to say 00000003e7931080; 00000003e7930000 is the start of cygz.dll.

> that got unloaded.  After installing zlib-debuginfo, I ran addr2line to see
> where the crash occurred, and this too crashed:
> 
> $ addr2line -C -f -i -p -e /usr/bin/cygz.dll 0x3e7931080
> Segmentation fault (core dumped)
> 
> That's as far as I've gotten.
> 
> Ken
> 
> --
> 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
> 

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

  reply	other threads:[~2019-10-29 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26 15:07 Roumen Petrov
2019-10-29 14:53 ` Ken Brown
2019-10-29 15:31   ` Ken Brown [this message]
2019-11-05 19:32     ` Roumen Petrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1805e95e-6733-7a73-56fe-8493389ae367@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).