I am trying to get the address of a private function in GLIBC.
For instance - the function __run_prefork_handlers()
.
I have done it with gdb, using info symbol __run_prefork_handlers
and info address __run_prefork_handlers
And I get the relevant information (relevant so) and address of the function.
I tried to get the address of this function programmatically using dlsym
.
Since glibc is loaded by runtime loader at startup I call dlsym(RTLD_GLOBAL, "__run_prefork_handlers")
without first calling dlopen
.
I get a NULL
pointer and perror returns:
undefined symbol: __run_prefork_handlers
Running the same code for symbol of an exported function such as fork
works well.
Which steps should I take to get this information within a program?
nm
,objdump
and/orreadelf
show that symbol in one of the symbol tables? If not, the debugger has probably used debug symbols to get that address. In theory, though, that's something you could also do: parse the debug data.