How to read symbols of an object file using C
Question is simple, i have a object file and i want to read the symbols of the object file via code. I am aware that the linux command "nm" woul开发者_运维百科d be able to do this, but i want to be able to do it inside code.
Also note id like to do this either via C or Python.
Regards
Paul
It would be nice to provide more details.
For some pointers:
- http://sourceforge.net/projects/python-elf/
- http://www.grant-olson.net/python/pyasm
You might also want to take a look into the python package BinTools:
http://code.google.com/p/pydevtools/
Although not completely documented, it is able to read elf files and its debug symbols
On linux object files are written in ELF file format.So i think you have to start with understanding the ELF file format and how OS write object file using this format.That can give you a idea how you can read object file and symbol table by your own program.To get some initial idea you can look into the source code of readelf tool.
精彩评论