Reputation: 13
I have one shared object file which gets loaded in memory dynamically using add-symbol-file in gdb.
gdb) add-symbol-file shared.so 0x1234
Doing this .text section loaded at 0x1234 memory. We can specify a section-specific address also. Can we specify of offset which can get added to all section addresses?
Similar like --slide in lldb debugger. which slides LOAD address by offset.
Upvotes: 0
Views: 1617
Reputation: 213375
I have one shared object file which gets loaded in memory dynamically
On most platforms, whey you dynamically load a shared object (e.g. via dlopen
), GDB will automatically add symbols from it without the need to add-symbol-file
.
If that isn't happening, you should describe your platform, and the mechanism by which the shared object gets loaded.
Can we specify of offset which can get added to all section addresses?
Yes.
Assuming the shared object was added with relocation 0x123456000
, and that the .text
section in that shared object starts at offset 0xabcd
, add-symbol-file 0x123456000+0xabcd
will do exactly what you want.
Upvotes: 0