GDB question
Posted: Sat Jan 16, 2010 6:36 am
Hi. During my OS design I encountered a problem with GDB remote debugging. When I try to continue execution of stopped kernel after remote connection to it (either by next, step, continue or any other command) the GDB tries to set breakpoint on the image entry point. The problem is that my OS image is loaded at low physical addresses (probably the most OS'es do that) and after that is remapped on highest virtual addresses. After the paging is enabled the temporal identity mapping in the lowest virtual addresses is invalidated and the original entry point becomes inaccessible. So the GDB cannot debug the kernel when I use Qemu built-in debugger:
0x200000 - is my OS loading address and entry point address.
For the OS-builtin debugger I use temporal workaround: when someone tries to read or write from boot-code range I translate these addresses to higher memory where the boot-code also is accessible. This works but in some cases I'm not able to use my built-in debugger (e.g. when the debugger itself needs to be debugged) and I need to use Qemu debugger. Probably GDB could have some option to not insert this breakpoint which still is not used. I searched for a such option but nothing found. May be somebody had similar problem and knows the solution? Thanks in advance.
Code: Select all
(gdb) n
Warning:
Cannot insert breakpoint -1.
Error accessing memory address 0x200000: Unknown error 4294967295.
For the OS-builtin debugger I use temporal workaround: when someone tries to read or write from boot-code range I translate these addresses to higher memory where the boot-code also is accessible. This works but in some cases I'm not able to use my built-in debugger (e.g. when the debugger itself needs to be debugged) and I need to use Qemu debugger. Probably GDB could have some option to not insert this breakpoint which still is not used. I searched for a such option but nothing found. May be somebody had similar problem and knows the solution? Thanks in advance.