【发布时间】:2019-10-30 11:22:41
【问题描述】:
我正在检查 ELF 二进制文件以查找下面提到的代码。 我在 Virtual Box 的 Ubuntu x86_64 系统上的 gcc 7.4.0 上将其编译为:
gcc -g scratch1.c -o scratch1.out
#include <stdio.h>
void do_stuff(int my_arg){
int my_local = my_arg + 2;
int i;
for (i = 0; i < my_local; ++i) printf("i = %d\n", i);
}
int main(){
do_stuff(2);
return 0;
}
但是,当我尝试引用 .debug_loc 部分时,它是空的。
objdump --dwarf=loc scratch1.out
scratch1.out: file format elf64-x86-64
虽然,我确实看到了一些其他的 debug_ 部分
[26] .debug_aranges PROGBITS 0000000000000000 0000103b
0000000000000030 0000000000000000 0 0 1
[27] .debug_info PROGBITS 0000000000000000 0000106b
000000000000035f 0000000000000000 0 0 1
[28] .debug_abbrev PROGBITS 0000000000000000 000013ca
0000000000000125 0000000000000000 0 0 1
[29] .debug_line PROGBITS 0000000000000000 000014ef
00000000000000e6 0000000000000000 0 0 1
[30] .debug_str PROGBITS 0000000000000000 000015d5
00000000000002b5 0000000000000001 MS 0 0 1
需要您的帮助,为什么缺少此部分。
【问题讨论】: