MIT jos lab,如何在 bootmain() 设置断点
MIT jos lab,how can I set breakpoint at bootmain()
首先,
我现在正在从 MIT-jos
学习 OS 实现
我想追踪位于 boot/main.c
中的 bootmain(void)
但是我不知道怎么设置断点,
我确实将 gdb 源目录设置为启动和 obj/boot
(gdb) dir boot:obj/boot
Source directories searched:
/home/osdi/lab/boot:/home/osdi/lab/obj/boot:$cdir:$cwd
当我在 bootmain(void) 设置断点时,
gdb 抱怨:
(gdb) b bootmain
Function "bootmain" not defined.
Make breakpoint pending on future shared library load? (y or [n])
那么,如何在bootmain(void?)正确设置断点
其次,
我只能通过地址设置断点
(gdb) b *0x7c00
Breakpoint 1 at 0x7c00
但是当我想列出代码时,gdb 再次抱怨 "No such file or directory"
[ 0:7c00] => 0x7c00: cli
Breakpoint 1, 0x00007c00 in ?? ()
(gdb) list
1 {standard input}: No such file or directory.
in {standard input}
那么,怎样才能正确列出信息呢?
谢谢~
追踪在boot/boot.asm
call bootmain
7c45: e8 c0 00 00 00 call 7d0a <bootmain>
Bootmain
函数开始于 0x7d0a
运行 最近和 google 遇到了同样的问题,但没有找到解决方案。阅读 gdb 输出和实验室指南并找到根本原因。
原来你需要将符号文件设置为boot,然后一切正常。请查看以下 gdb 输出。在行'+ symbol-file obj/kern/kernel',我们可以看到它使用kernel默认为符号文件。由于 bootmain() 位于 boot,所以我们需要切换到 boot 符号文件。
我已经在blog中总结了。
The target architecture is assumed to be i8086
[f000:fff0] 0xffff0: ljmp [=10=]xf000,[=10=]xe05b
0x0000fff0 in ?? ()
+ symbol-file obj/kern/kernel
(gdb) symbol-file obj/boot/boot.out
Load new symbol table from "obj/boot/boot.out"? (y or n) y
Reading symbols from obj/boot/boot.out...done.
(gdb) b bootmain
Breakpoint 1 at 0x7d15: file boot/main.c, line 40.
(gdb) c
Continuing.
首先, 我现在正在从 MIT-jos
学习 OS 实现我想追踪位于 boot/main.c
中的 bootmain(void)但是我不知道怎么设置断点,
我确实将 gdb 源目录设置为启动和 obj/boot
(gdb) dir boot:obj/boot
Source directories searched:
/home/osdi/lab/boot:/home/osdi/lab/obj/boot:$cdir:$cwd
当我在 bootmain(void) 设置断点时, gdb 抱怨:
(gdb) b bootmain
Function "bootmain" not defined.
Make breakpoint pending on future shared library load? (y or [n])
那么,如何在bootmain(void?)正确设置断点
其次, 我只能通过地址设置断点
(gdb) b *0x7c00
Breakpoint 1 at 0x7c00
但是当我想列出代码时,gdb 再次抱怨 "No such file or directory"
[ 0:7c00] => 0x7c00: cli
Breakpoint 1, 0x00007c00 in ?? ()
(gdb) list
1 {standard input}: No such file or directory.
in {standard input}
那么,怎样才能正确列出信息呢?
谢谢~
追踪在boot/boot.asm
call bootmain
7c45: e8 c0 00 00 00 call 7d0a <bootmain>
Bootmain
函数开始于 0x7d0a
运行 最近和 google 遇到了同样的问题,但没有找到解决方案。阅读 gdb 输出和实验室指南并找到根本原因。
原来你需要将符号文件设置为boot,然后一切正常。请查看以下 gdb 输出。在行'+ symbol-file obj/kern/kernel',我们可以看到它使用kernel默认为符号文件。由于 bootmain() 位于 boot,所以我们需要切换到 boot 符号文件。
我已经在blog中总结了。
The target architecture is assumed to be i8086
[f000:fff0] 0xffff0: ljmp [=10=]xf000,[=10=]xe05b
0x0000fff0 in ?? ()
+ symbol-file obj/kern/kernel
(gdb) symbol-file obj/boot/boot.out
Load new symbol table from "obj/boot/boot.out"? (y or n) y
Reading symbols from obj/boot/boot.out...done.
(gdb) b bootmain
Breakpoint 1 at 0x7d15: file boot/main.c, line 40.
(gdb) c
Continuing.