我正在开发一个实用程序,该实用程序需要将十六进制地址解析为二进制内的符号函数名称和源代码行号.该实用程序将在x86的Linux上运行,尽管它分析的二进制文件将用于基于MIPS的嵌入式系统. MIPS二进制文件采用ELF格式,并使用DWARF作为符号调试信息.
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.
我目前正计划分叉objdump,传入十六进制地址列表并解析输出以获取函数名称和源代码行号.我已经编译了一个支持MIPS二进制文件的objdump,并且可以正常工作.
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.
我更希望有一个软件包,该软件包可以让我从Python代码中本机查找内容,而无需进行其他处理.在python上找不到libdwarf,libelf或libbfd,在dwarfstd上也没有提及python.
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, nor any mention of python on dwarfstd.
某处有合适的模块吗?
推荐答案请检查 pyelftools -一个新纯Python库就是要做到这一点.
Please check pyelftools - a new pure Python library meant to do this.
更多推荐
分析MIPS二进制文件:是否有用于解析二进制数据的Python库?
发布评论