c - Function address is different in nm output and gdb -
let's focus on rect_isempty()
function.
the nm
command gives me output:
(...) 00021af0 t rect_isempty (...)
on other hand, when launch gdb
, see address of function, get:
(gdb) info address rect_isempty symbol "rect_isempty" @ 0x8057c84 in file compiled without debugging.
could anyone, please, explain why these addresses not same? gdb address from?
nm
gives mangled name symbol table's address offset.
gdb
gives actual virtual process's memory address. when looking address of function (in case gdb), shows address of inside code segment of unit located: current process or shared library. if function located inside object file running, code segment being loaded process's memory each time run os. in other case, if function in shared library , don't explicitly load dlopen
, os loads it's code segment no in process memory in place. so, code segment
of shared libraries shared between applications using it, it's data segment
still loaded in process's memory space of each process linked shared library.
p.s. afaik, plain c
functions not mangled in symbols table. don't see function name being mangled, can remove c++
tag here because not related it.
p.p.s. this article ibm shared libraries. procedure linkage table , global offset table.
that's reason don't here plt
, got
- goodly explain in these links above.
Comments
Post a Comment