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?


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

If not, how do folks tell that init_priority is being honored? And if
init_priority in not in effect, how can we tell the order of object
creation?

Jeff

  $ LD_DEBUG=libs ./cryptest.exe v
     32732:    find library=libstdc++.so.6 [0]; searching
     32732:     search cache=/etc/ld.so.cache
     32732:      trying file=/usr/lib/aarch64-linux-gnu/libstdc++.so.6
     32732:
     32732:    ...
     32732:    initialize program: ./cryptest.exe
     32732:
     32732:    transferring control: ./cryptest.exe
     32732:


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