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.
How do you debug the Intel assembly?
Re: How do you debug the Intel assembly?
Try using Bochs. It has an amazing integrated ASM debugger. Note that AFAIK Bochs can't display symbol information (although you might be able to load one in, I'm not sure), but it still is great.
Try looking at the Bochs wiki page.
Try looking at the Bochs wiki page.
Re: How do you debug the Intel assembly?
Thanks for your response. Now I use the VScode to conduct the gdb running in the Linux server. Building this framework would take me a long time. Do you know how the Bochs and gdb co-work with each other? Do you know how to set the Bochs and gdb?nexos wrote:Try using Bochs. It has an amazing integrated ASM debugger. Note that AFAIK Bochs can't display symbol information (although you might be able to load one in, I'm not sure), but it still is great.
Try looking at the Bochs wiki page.
Re: How do you debug the Intel assembly?
You can set breakpoints at individual addresses in gdb with the command.
Code: Select all
break *0x1234
Re: How do you debug the Intel assembly?
Yes, but the problem is that I don’t know the address. Hahahahahaiansjack wrote:You can set breakpoints at individual addresses in gdb with the command.Code: Select all
break *0x1234
Re: How do you debug the Intel assembly?
Then produce a linker map file. Or use objdump to inspect your executable.