This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Display initialization order of static C++ objects in a library or program?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]