现在的位置: 首页 > 综合 > 正文

GNU Binutils工具

2011年09月17日 ⁄ 综合 ⁄ 共 2584字 ⁄ 字号 评论关闭

http://www.gnu.org/software/binutils/

http://sourceware.org/binutils/docs-2.23.1/

http://sourceware.org/binutils/docs-2.23.1/binutils/index.html

http://yunli.blog.51cto.com/831344/186727 (推荐)

http://wenku.baidu.com/view/fc8e70a1284ac850ad02424c.html

 

GNU Binutils是一套二进制工具集,提供了一系列用来创建、管理和维护二进制目标文件的工具程序。Binutils包括以下工具:

The GNU Binutils are a collection of binary tools. The main ones are:

  • ld - the GNU linker.
  • as - the GNU assembler.

But they also include:

  • addr2line - Converts addresses into filenames and line numbers.
  • (如果程序编译的时候,添加了-g选项,该命令可以从符号表里面的地址找到对应的代码行数信息)

[guest@host search_lau]$ dmesg |grep seg
is_searcher_ser[5701]: segfault at 0000000000000000 rip 00000000006a1425 rsp 0000000043c0ef10 error 4
is_searcher_ser[17723]: segfault at 0000000000000000 rip 00000000006a1425 rsp 0000000047196f10 error 4
[guest@host search_lau]$ addr2line  00000000006a1425 -e bin/is_searcher_server
/home/ascc_build1358835605903/b2b-isearch_cn/include/build/AttributeReader.h:118

  • ar - A utility for creating, modifying and extracting from archives.
  • c++filt - Filter to demangle encoded C++ symbols.

       (由于C++多态在编译时对函数和变量的变化,造成阅读上的不便,该命令可以方便的查看)

[admin@inc-search-p4p-150-46 ~]$ nm is_searcher_server |grep discover
000000000048c230 T _ZN5query14CIndexSearcher8discoverEPKcb
[admin@inc-search-p4p-150-46 ~]$ nm is_searcher_server |grep discover |xargs c++filt
000000000048c230
T
query::CIndexSearcher::discover(char const*, bool)

 

  • dlltool - Creates files for building and using DLLs.
  • gold - A new, faster, ELF only linker, still in beta test.
  • gprof - Displays profiling information.
  • nlmconv - Converts object code into an NLM.
  • nm - Lists symbols from object files.
  • objcopy - Copys and translates object files.
  • objdump - Displays information from object files.
  • ranlib - Generates an index to the contents of an archive.
  • readelf - Displays information from any ELF format object file.
  • size - Lists the section sizes of an object or archive file.
  • strings - Lists printable strings from files.
  • strip - Discards symbols.
  • windmc - A Windows compatible message compiler.
  • windres - A compiler for Windows resource files.

 

http://davidgao.github.io/LFSCN/chapter06/binutils.html

addr2line

将程序地址翻译成文件名和行号;给定地址和可执行文件名称,它使用其中的调试信息判断与此地址有关联的源文件和行号

ar

创建、修改和提取归档

as

一个汇编器,将 gcc 的输出汇编为对象文件 into object files

c++filt

被链接器用于修复 C++ 和 Java 符号,防止重载的函数相互冲突

elfedit

更新 ELF 文件的 ELF 头

gprof

显示分析数据的调用图表

ld

一个链接器,将几个对象和归档文件组合成一个文件,重新定位它们的数据并且捆绑符号索引

ld.bfd

到 ld 的硬链接

nm

列出给定对象文件中出现的符号

objcopy

将一种对象文件翻译成另一种

objdump

显示有关给定对象文件的信息,包含指定显示信息的选项;显示的信息对编译工具开发者很有用

ranlib

创建一个归档的内容索引并存储在归档内;索引列出其成员中可重定位的对象文件定义的所有符号

readelf

显示有关 ELF 二进制文件的信息

size

列出给定对象文件每个部分的尺寸和总尺寸

strings

对每个给定的文件输出不短于指定长度 (默认为 4) 的所有可打印字符序列;对于对象文件默认只打印初始化和加载部分的字符串,否则扫描整个文件

strip

移除对象文件中的符号

libiberty

包含多个 GNU 程序会使用的途径,包括 getoptobstackstrerrorstrtol 和 strtoul

libbfd

二进制文件描述器库

libopcodes

一个库,用于处理 opcodes——处理器指令的 “可读文本” 版本;用于编制 objdump 这样的工具

抱歉!评论已关闭.