I've got a binary installed on my system, and would like to look at the disassembly of a given function. Preferrably using objdump
, but other solutions would be acceptable as well.
From this questions I've learned that I might be able to disassemble part of the code if I only know the boundary addresses. From this answer I've learned how to turn my split debug symbols back into a single file.
But even operating on that single file, and even disassembling all the code (i.e. without start or stop address, but plain -d
parameter to objdump
), I still don't see that symbol anywhere. Which makes sense insofar as the function in question is static, so it isn't exported. Nevertheless, valgrind
will report the function name, so it has to be stored somewhere.
Looking at the details of the debug sections, I find that name mentioned in the .debug_str
section, but I don't know a tool which can turn this into an address range.
I would suggest using gdb as the simplest approach. You can even do it as a one-liner, like:
gdb -batch -ex 'file /bin/ls' -ex 'disassemble main'