gdb print symbol at address relative to base address

4.2k views Asked by At

I found a suspicious deadlock at address myfile.exe+0x144c7 (from list of threads in ProcessExplorer). Now, I want to know which function it is.

info symbol addr

requires that addr is absolute. Is there a command that takes the relative address given by ProcessExplorer. I can add 0x400000 but it would be better if GDB could do it for me.

1

There are 1 answers

2
Dan Bonachea On

gdb accepts an expression for the symbol address, so you can do something like this:

info symbol 0x40000000 + 0x144c7

If you check "info variables" (or use nm on the executable) there's probably a symbolic name for the text segment containing your code, so you can also do something like:

info symbol _init + 0x144c7

Note that symbol might not work as expected if your problem is in a DLL or other text segment.