objcopy –only-keep-debug a.out a.out.sym
如果您希望GDB 自动 加载a.out.sym
,请遵循此处概述的步骤(特别注意,您需要执行“添加
.gnu_debuglink”步骤)。
这个地址代表什么
GDB想要的地址是
.text二进制代码段的位置。要找到它,请使用
readelf -WS a.out。例如
$ readelf -WS /bin/dateThere are 28 section headers, starting at offset 0xe350:Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .interpPROGBITS 0000000000400238 000238 00001c 00 A 0 0 1... [13] .text PROGBITS 0000000000401900 001900 0077f8 00 AX 0 0 16
在这里,您想给GDB
0x401900作为加载地址。


![文件名已加载的地址丢失[GDB] 文件名已加载的地址丢失[GDB]](http://www.mshxw.com/aiimages/31/409084.png)
