static vs. shared linking

David Stacey drstacey@tiscali.co.uk
Mon Mar 30 19:17:00 GMT 2015


On 30/03/15 11:55, Corinna Vinschen wrote:
> On Mar 25 22:42, David Stacey wrote:
>> I've never had much joy out of addr2line before, and I'm struggling to
>> recreate what you've done. I've added '-g' to the command line, run 'go.sh'
>> again. This generates a fresh stackdump file, and then I do:
>>   
>> awk '/^[0-9]/{print $2}' shared_test.exe.stackdump | addr2line -f -e
>> shared_test.exe
>>   
>> but I just see question marks. Please could you show the exact lines you're
>> using.
> addr2line is a bit dumb and needs help.  What I do is to cat the
> stackdump file and look at the addresses.  They usually show where
> the stuff comes from:
>
>    $ gawk '/^0/{print $2}' mkgroup.exe.stackdump
>    7FFBDC82DDB6
>    001800FEC36
>    001800FE188
>    001800CF471
>    001800CF53D
>    0018007EAC1
>    00100402DE6
>    00180049411
>    00180046369
>    00180046180
>    00180049488
>    00100401351
>    00100401010
>    7FFBD9FE13D2
>    7FFBDC85EB64
>
> The 7f addresses are from OS DLLs you can't read with addr2line.
> 0018xxx is the Cygwin DLL, 0010xxx is the application itself.  Other
> addresses are other DLLs.  Just check the addresses against
> /etc/rebase.db.x86_64.
>
> Then call addr2line for each object file, e.g.:
>
>    $ addr2line -e /usr/bin/cygwin1.dll 001800FEC36 001800FE188 001800CF471
>    [...]/cygwin/passwd.cc:576
>    [...]/cygwin/passwd.cc:353
>    [...]/cygwin/grp.cc:413
>    $ addr2line -e /usr/bin/mkgroup.exe 00100401351 00100401010
>    /usr/src/debug/cygwin-1.7.35-1/winsup/cygwin/lib/cygwin_crt0.c:22
>    /usr/src/debug/cygwin-1.7.35-1/winsup/cygwin/crt0.c:34

Thank you for your reply and the explanation. That requires quite a bit 
of knowledge before addr2line is usable - no wonder I've never had 
anything sensible out of it before!

Back to the matter in hand - I don't suppose you had thoughts on why my 
simple application crashes when linked as shared, but works fine when 
linked statically?

Dave.


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



More information about the Cygwin mailing list