I know that one can use func to get the current function name statically.
Get called function name as string
But if I want to get the function that calls this function, it has to be done dynamically.
Is there a way to do so in C (without adding an arugment to the current function that pass the caller function name)?
I don't want to dramatically slow down the execution of the program. So gdb is not an option?
dladdr may be useful for shared library. I'd like something for statically compiled executable as well.
http://man7.org/linux/man-pages/man3/dladdr.3.html
EDIT:
Things like this are not helpful. If want to get the caller function name for each callee, it will require editing for each function, which is not a scalable solution.
How can we know the caller function's name?
Thanks.