Analizing MIPS binaries: is there a Python library for parsing binary data?
<p>I'm working on a utility which needs to resolve hex addresses to a symbolic function name and source code line number within a binary. The utility will run on Linux on x86, though the binaries it analyzes will be for a MIPS-based embedded system. The MIPS binaries are in ELF format, using DWARF for the symbolic debugging information.</p>

<p>I'm currently planning to fork objdump, passing in a list of hex addresses and parsing the output to get function names and source line numbers. I have compiled an objdump with support for MIPS binaries, and it is working.</p>

<p>I'd prefer to have a package allowing me to look things up natively from the Python code without forking another process. I can find no mention of libdwarf, libelf, or libbfd on python.org, nor any mention of python on dwarfstd.org.</p>

<p>Is there a suitable module available somewhere?</p>

<p>You might be interested in the DWARF library from <a href="http://code.google.com/p/pydevtools/" rel="nofollow">pydevtools</a>:</p>

<pre><code>&gt;&gt;&gt; from bintools.dwarf import DWARF
&gt;&gt;&gt; dwarf = DWARF('test/test')
&gt;&gt;&gt; dwarf.get_loc_by_addr(0x8048475)
('/home/emilmont/Workspace/dbg/test/main.c', 36, 0)
</code></pre>
