开发者

How to read symbols of an object file using C

开发者 https://www.devze.com 2023-01-14 00:42 出处:网络
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 a

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:

  1. http://sourceforge.net/projects/python-elf/
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号