I want to write a little function's tracer. I use ptrace.
When I see a CALL instruction, I want to show the function name equivalent to the address call.
My tracer work with symbols with absolute address (symbol define in the main binary). But I don't know how I can get the absolute address in virtual memory of the function of the shared library. Detect the call to libc's functions for example.
I notice that the address of the function in the shared library is relative to the file.
Does the following equation is good?
Absolute address of symbol = address of the shared library in virtual memory +
relative address of the symbol.
How can I get the absolute address of a symbol from a shared library?