Книга: Embedded Linux Primer: A Practical, Real-World Approach
13.6.2. addr2line
13.6.2. addr2line
When we highlighted mtrace in Listing 13-12, you saw that the output from the mtrace analysis script contained file and line number information. The mTRace Perl script used the addr2line utility to read the debug information contained in the executable ELF file and display a line number corresponding to the address. Using the same mtrace example executable, we can find a filename and line number for a virtual address:
$ addr2line -f -e mt_ex 0x80487c6
put_data
/home/chris/examples/mt_ex.c:64
Notice that the function put_data() is also listed together with the file and line number. This says that the address 0x80487c6 is on line 64 of the mt_ex.c file, in the put_data() function. This is even more useful in larger binaries consisting of multiple filenames, such as the Linux kernel:
$ ppc_82xx-addr2line -f -e vmlinux c000d95c
mpc52xx_restart
arch/ppc/syslib/mpc52xx_setup.c:41
This particular example highlights one of the points repeated throughout this chapter: This is an architecture-specific tool. You must use a tool configured and compiled to match the architecture of the target binary that you are using. As with the cross-compiler, addr2line is a cross-tool and part of the binary utilities package.
- Specifying Client IP Addresses
- QLineEdit
- Addrtype match
- Internet Service Providers who use assigned IP addresses
- Creating CDs from the Command Line
- 11.19. Функции gethostbyname_r и gethostbyaddr_r
- Параметры сокета SO_REUSEADDR и SO_REUSEPORT
- Kernel Address Space
- CHAPTER 4 Command-Line Quick Start
- Accessing the Command Line
- Understanding the Command Line
- Creating DVDs from the Command Line