tags:

views:

49

answers:

2

Hi guys,

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" would 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

A: 

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.

Anil Vishnoi
Thanks Anil, just needed someone to point me in the right direction.
paultop6
A: 

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
pyfunc