0

I am using gdb to debug boot loader code in xv6. In bootasm.S, I can use gdb to debug assembly code as expected. Then at the end of bootasm.S, we will call bootmain (line 9168, call bootmain) and the execution will go into the bootmain function of the C code bootmain.c. Since it is a C code, I wish to step over the C statements instead of assembly. I know that the step command of gdb is for this purpose, but after I input 's', I received an error message: Cannot find bounds of current function. The same error shows up no matter I input 's' before or after the call bootmain instruction. So, is it possible to step C statements in gdb when the execution switches from an assembly source to a C source like the situation described above? If it is, how to do that? Thank you.

PS1: The list command only list the main() source of the kernel.

PS2: The remote terminal ran make qemu-gdb to start the QEMU, and the local terminal ran gdb kernel to start the debug session, following steps here. I think the C source code symbols like bootmain function should be included so I should be able to step the C code in it.

Thank you again for your help!

user5280911
  • 723
  • 1
  • 8
  • 21
  • you can try to turn off optimizations on 'c' build with '-O0' and bump up debugging level with '-g2'. – Serge Apr 21 '18 at 11:11
  • @Serge: I changed -O2 to -O0 and added -g2 after -ggdb in line 79 of Makefile, and rebuild (make clean and make qemu-gdb), but got the same error around `call bootmain'. – user5280911 Apr 21 '18 at 20:19
  • I noticed that your gdb version is too old, try to get 8.1. Also use -g2 at the assembly command line as well (with -ggdb). – Serge Apr 21 '18 at 21:35

0 Answers0