How do you debug the Intel assembly?
Posted: Sun Oct 03, 2021 1:26 pm
Hello, everyone. I am an OS development beginner. Debugging is a very useful approach to help us find mistakes. I know how to debug the C language in the kernel. But kernel not only includes C language but also including a lot of assembly language. The interesting things are I can use the gdb to debug the C language parts of the kernel, instead of assembly. When I put the breakpoint in assembly, the gdb wouldn't go there, so that I can't see any debug information in it. I make sure I added the -g option in nasm and GCC. The more detail you can see in my makefile. My OS project is https://github.com/xubenji/DolphinOS.
You can download the project and enter the DolphinOS directory to run it.
Running this project in qemu with debug model is:
root@benji:~/make s
Then open gdb, make sure attached the symbol file: kelf.
: symbol-file kelf
You end up connecting to the qemu with this instruction:
target remote localhost:1234
When you set the breakpoint in handler_ASM.asm, io_ASM.asm and switch_ASM.asm, you will find that the gdb wouldn't go to those files. It is pretty strange. Do you know how to solve this problem? I appreciate you very much.
You can download the project and enter the DolphinOS directory to run it.
Running this project in qemu with debug model is:
root@benji:~/make s
Then open gdb, make sure attached the symbol file: kelf.
: symbol-file kelf
You end up connecting to the qemu with this instruction:
target remote localhost:1234
When you set the breakpoint in handler_ASM.asm, io_ASM.asm and switch_ASM.asm, you will find that the gdb wouldn't go to those files. It is pretty strange. Do you know how to solve this problem? I appreciate you very much.