Display initialization order of static C++ objects in a library or program?
Jeffrey Walton
noloader@gmail.com
Sat Jan 9 23:19:00 GMT 2016
> 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:
More information about the Binutils
mailing list