given a C++ program with:
int a;
I'd like to obtain the symbol name ("a") of address &a at runtime. I can do it via objdump but can I also do it at runtime? If there exists a way, how do I demangle its name?
Context: I need to profile an application (nope perf does not work in my case) so I am wrapping function calls, e.g. pthread_mutex_lock() using global defines and then track the address of the mutex variable and the RIP of the pthread_mutex_lock() call. I can do the postprocessing by calling into objdump (address to mangled_name mapping) I just thought there exists an API to do it at runtime.