This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Display initialization order of static C++ objects in a library or program?
- From: Matt Rice <ratmice at gmail dot com>
- To: noloader at gmail dot com
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sat, 9 Jan 2016 17:20:51 -0800
- Subject: Re: Display initialization order of static C++ objects in a library or program?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8mRamf3ZR+Onm5ny3w13dvsyLjbZ2QCDafAXF_WzM4CPQ at mail dot gmail dot com> <CACTLOFoPHZFVF64dGB40n-0iSpJ8AQgXwLkBOMM_MWt38=W8Pg at mail dot gmail dot com> <CAH8yC8k5BWB-HC7mzZY+0BLeAwV4Oa2Sz98ck0RhHNUbtOJ_ug at mail dot gmail dot com>
On Sat, Jan 9, 2016 at 3:19 PM, Jeffrey Walton <noloader@gmail.com> wrote:
>> This is by its nature platform dependent, with glibc you can get this
>> information by setting the environment variable LD_DEBUG=libs (the
>> calling init: lines), but don't expect the initialization order to
>> produce the same results on another platform.
>
> Thanks Matt. That may come in handy.
>
> Below is what I am seeing. I'm looking for more detail at "32732:
> initialize program: ./cryptest.exe". I want to see the symbolic name
> of each object created, and the order in which it was created. For
> example,
>
> 32732: initialize program: ./cryptest.exe
> 32732: initializing std::string DEFAULT_CHANNEL
> 32732: initializing std::string AAD_CHANNEL
> ...
> 32732: initializing Foo g_bar
> ...
>
> Is that possible to do?
I'm not aware of anything that will do this sort of thing
automagically printing symbols..
with gdb you can either set breakpoints on the constructors manually
or set a breakpoint on '_init' and step through to them.
hope that helps