sky 发表于 2020-10-22 20:33:05

GNU Binutils

本帖最后由 sky 于 2020-10-22 20:36 编辑

了解更多,参考:https://www.gnu.org/software/binutils/
一、GNU BinutilsThe GNU Binutils are a collection of binary tools/utility. The main ones are:

[*]ld - the GNU linker.
[*]as - the GNU assembler.

But they also include:

[*]addr2line - Converts addresses into filenames and line numbers.
[*]ar - A utility for creating, modifying and extracting from archives.
[*]c++filt - Filter to demangle encoded C++ symbols.
[*]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 - Copies 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.

Most of these programs use BFD, the Binary File Descriptor library, to do low-level manipulation. Many of them also use the opcodes library to assemble and disassemble machine instructions.
The binutils have been ported to most major Unix variants as well as Wintel systems, and their main reason for existence is to give the GNU system (and GNU/Linux) the facility to compile and link programs.
二、objdump
objdump,可以用来将编译后的目标文件反汇编成汇编代码,对于研究学习编程语言(C/C++)有用。还有另外两个工具,名字叫“gdb”、“readelf”,有windows/Linux版本。
objdump is a command-line program for displaying various information about object files on Unix-like operating systems. For instance, it can be used as a disassembler to view an executable in assembly form. It is part of the GNU Binutils for fine-grained control over executables and other binary data. objdump uses the BFD library to read the contents of object files. Similar utilities are Borland TDUMP, Microsoft DUMPBIN and readelf.
Note that on certain platforms (e.g. Mac OS X), the objdump binary may actually be a link to llvm's objdump, with different command-line options and behavior.
objdump [ -a | --archive-headers ]       [ -b bfdname | --target=bfdname ]      [ -d | --disassemble ][ -D | --disassemble-all ]       [ -f | --file-headers ]      [ -h | --section-headers | --headers ][ -i | --info ]      [ -j section | --section=section ]      [ -l | --line-numbers ]      [ -m machine | --architecture=machine ]      [ -r | --reloc ] [ -R | --dynamic-reloc ]      [ -s | --full-contents ][ --stabs ]      [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ]      [ --version ][ --help ] objfile...

举例:


查看汇编文本内容,这是intel的,也可以反汇编出针对 ARM MCU(Cortex-A8)的汇编指令:
gdb:

windows version

三、GNU DDDWhat is DDD?
GNU DDD is a graphical front-end for command-line debuggers such as GDB, DBX, WDB, Ladebug, JDB, XDB, the Perl debugger, the bash debugger bashdb, the GNU Make debugger remake, or the Python debugger pydb. Besides ``usual'' front-end features such as viewing source texts, DDD has become famous through its interactive graphical data display, where data structures are displayed as graphs.

For more information (and more screenshots), see the DDD Manual.
页: [1]
查看完整版本: GNU Binutils