问题
If I look at the file's bytes I can definately see some of the function names in there. Is there any tool that will list them for me? Maybe even their parameters too?
回答1:
This should print all defined symbols within your object file or library.
nm -C --defined-only file.o
nm
has quite a lot of options that you could use to filter out the symbols like -g
for displaying only global symbols
, -l
for printing the line number (if you had used gcc -g
to enable debug symbols) and so on.
If you have an ELF format binary (looks to be your case), you could also use readelf
readelf -Ws file.o
The column number 8 in this output contains the symbol name which is of interest. You could use c++filt
to demangle the name:
readelf -Ws file.o | awk '{print $8}' | c++filt
来源:https://stackoverflow.com/questions/15193416/how-can-i-view-function-names-and-parameters-contained-in-an-elf-file