You can try the function dladdr()
. It uses the dynamic symbols of the program, not the debugging information (compile the program with gcc -rdynamic
).
Also, you can check the backtrace library, or the higher level stacktrace library.
Not exactly what you are asking, but they may prove useful.