c++ - In shared library's constructor (_init section), how to know what function is interrupted? -


on x86 linux, process a.exe invokes dlopen() load shared library b.so. in b.so, there's constructor, wants know function in process a.exe interrupted right before dlopen() invoked.

how can constructor (_init section) in b.so know?

if understand question correctly (the 'interrupting' might misleading), application has several locations might call dlopen() , want know of these locations called.

first of all, smells wrong, because shared library should not supposed make assumptions loading it. if so, instance not run application in valgrind, because in case valgrind loading instead of standard dynamic linker , results might screwed.

second, if need (why?), might take backtrace in constructor function. search upwards until find dlopen() , on next higher stack frame find function called dlopen.

edit: map addresses in stack trace functions, need debug info of involved binaries or other way map function addresses symbol names.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -