调试C:GDB返回“缺少<file>的加载地址”

时间:2020-03-11 19:23:12

标签: c gdb grub

我是C语言的新手,并负责修改GRUB。有什么学习方法,对不对?无论如何,我正在尝试使用VMWare和GDB调试修改后的GRUB。我以前可以使调试器正常工作,但是由于某种原因,每次我加载VM并连接GDB时,在GRUB的加载过程中,我都会得到:

.loadsym.gdb:1: Error in sourced command file:
The address where biosdisk.module has been loaded is missing

,我不知道该怎么办。我的第一个念头是:“哦,我会add-symbol-file <file>,就可以解决它!”但是显然,这告诉GDB忘记了它加载的所有其他符号?因此,我无法添加符号文件并设置断点。

我的Google搜索只返回了一个semi-relevant post,实际上并没有深入解决这个问题。

此输出也可能有用。

info file biosdisk.module
Symbols from "H:\Workspace\GRUB\Bootloader\Trunk\grub-core\kernel.exec".
Remote serial target in gdb-specific protocol:
Debugging a target over a serial line.
        While running this, GDB does not access memory from...
Local exec file:
        `H:\Workspace\GRUB\Bootloader\Trunk\grub-core\kernel.exec', file type elf32-i386.
        Entry point: 0x9000
        0x00009000 - 0x0000e6e0 is .text
        0x0000e6e0 - 0x0000f68d is .rodata
        0x0000f6a0 - 0x0000fe74 is .data
        0x0000fe80 - 0x000175d4 is .bss

1 个答案:

答案 0 :(得分:0)

最后是我的代码库不一样。也就是说,在Windows主机上,我有一个代码副本,而在Ubuntu VM上是另一个。

使用版本控制解决了此问题。