扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共8页)
除了所有这些段之外,编译器可以将调试信息放入到目标文件中,并且还可以显示这些信息。输入下面的命令,仔细分析编译器的输出(假设您扮演了调试程序的角色):
readelf --debug-dump a.out | less |
这个命令生成的输出如清单 5 所示。调试工具,如 GDB,可以读取这些调试信息,并且当程序在调试器中运行的同时,您可以使用该工具显示更具描述性的标记,而不是对代码进行反汇编时的原始地址值。
The section .debug_aranges contains: Length: 28 Version: 2 Offset into .debug_info: 0 Pointer Size: 4 Segment Size: 0 Address Length 080482c0 34 Length: 52 Version: 2 Offset into .debug_info: 10b Pointer Size: 4 Segment Size: 0 Address Length 08048308 4 08048458 18 08048278 11 080482e4 36 Length: 44 Version: 2 Offset into .debug_info: 19b Pointer Size: 4 Segment Size: 0 Address Length 08048308 4 0804846f 6 0804828d 2 Contents of the .debug_pubnames section: Length: 33 Version: 2 Offset into .debug_info section: 122 Size of area in .debug_info section: 145 Offset Name 121 _IO_stdin_used The section .debug_info contains: Compilation Unit @ offset 0x0: Length: 118 Version: 2 Abbrev Offset: 0 Pointer Size: 4 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0 DW_AT_low_pc : 0x80482c0 DW_AT_high_pc : 0x80482e2 DW_AT_name : ../sysdeps/i386/elf/start.S DW_AT_comp_dir : /build/buildd/glibc-2.3.6/build-tree/glibc-2.3.6/csu DW_AT_producer : GNU AS 2.16.91 DW_AT_language : 32769 (MIPS assembler) Compilation Unit @ offset 0x7a: Length: 141 Version: 2 Abbrev Offset: 20 Pointer Size: 4 <0><85>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0x5b DW_AT_high_pc : 0x80482e4 DW_AT_low_pc : 0x80482e4 DW_AT_producer : (indirect string, offset: 0x62): GNU C 3.4.6 DW_AT_language : 1 (ANSI C) DW_AT_name : (indirect string, offset: 0x0): init.c DW_AT_comp_dir : (indirect string, offset: 0x11): /build/buildd/... <1><9f>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x90): unsigned int DW_AT_byte_size : 4 DW_AT_encoding : 7 (unsigned) <1><a6>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x54): unsigned char DW_AT_byte_size : 1 DW_AT_encoding : 8 (unsigned char) <1><ad>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x9d): short unsigned int DW_AT_byte_size : 2 DW_AT_encoding : 7 (unsigned) <1><b4>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x8b): long unsigned int DW_AT_byte_size : 4 DW_AT_encoding : 7 (unsigned) <1><bb>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x56): signed char DW_AT_byte_size : 1 DW_AT_encoding : 6 (signed char) <1><c2>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x7): short int DW_AT_byte_size : 2 DW_AT_encoding : 5 (signed) <1><c9>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : int DW_AT_byte_size : 4 DW_AT_encoding : 5 (signed) <1><d0>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x46): long long int DW_AT_byte_size : 8 DW_AT_encoding : 5 (signed) <1><d7>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x86): long long unsigned int DW_AT_byte_size : 8 DW_AT_encoding : 7 (unsigned) <1><de>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x4b): long int DW_AT_byte_size : 4 DW_AT_encoding : 5 (signed) <1><e5>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x90): unsigned int DW_AT_byte_size : 4 DW_AT_encoding : 7 (unsigned) <1><ec>: Abbrev Number: 2 (DW_TAG_base_type) DW_AT_name : (indirect string, offset: 0x5d): char DW_AT_byte_size : 1 DW_AT_encoding : 6 (signed char) <1><f3>: Abbrev Number: 4 (DW_TAG_variable) DW_AT_name : (indirect string, offset: 0xb0): _IO_stdin_used DW_AT_decl_file : 1 DW_AT_decl_line : 25 DW_AT_type : <105> DW_AT_external : 1 DW_AT_location : 5 byte block: 3 7c 84 4 8 (DW_OP_addr: 804847c) <1><105>: Abbrev Number: 5 (DW_TAG_const_type) DW_AT_type : <c9> Compilation Unit @ offset 0x10b: Length: 140 Version: 2 Abbrev Offset: 86 Pointer Size: 4 <0><116>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0x82 DW_AT_name : /build/buildd/glibc-2.3.6/build-tree/i386-libc/csu/crti.S DW_AT_comp_dir : /build/buildd/glibc-2.3.6/build-tree/glibc-2.3.6/csu DW_AT_producer : GNU AS 2.16.91 DW_AT_language : 32769 (MIPS assembler) Compilation Unit @ offset 0x19b: Length: 140 Version: 2 Abbrev Offset: 102 Pointer Size: 4 <0><1a6>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0x12f DW_AT_name : /build/buildd/glibc-2.3.6/build-tree/i386-libc/csu/crtn.S DW_AT_comp_dir : /build/buildd/glibc-2.3.6/build-tree/glibc-2.3.6/csu DW_AT_producer : GNU AS 2.16.91 DW_AT_language : 32769 (MIPS assembler) |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者