GDB debugging with edition 3? #1379
-
Has anyone successfully done debugging a UEFI OS following edition 3? I can set a breakpoint (with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 14 replies
-
What's your current setup? How do you connect to qemu? How do you load the symbols in gdb? |
Beta Was this translation helpful? Give feedback.
-
AFAIK the UEFI firmware relocates EFI executables. The debugger is not aware of this however and would look at the original location (if the GDB you use even supports the PE executable format in the first place) You may have better luck with using BIOS. |
Beta Was this translation helpful? Give feedback.
You have to tell
gdb
where to look for the symbols.(this is simplified) Your bootloader doesn't load the kernel at
0x00
. You're givinggdb
your symbols file, and invokeb main.rs:281
. This resolves to address0x43652
in the symbols file.gdb
(or QEMU) will now pause when the instruction pointer hits0x43652
.The problem is, that your kernel is not loaded at
0x00
, but at0xffff_fff8_0000_0000
(or somewhere in that area). You have to tellgdb
to always add that offset to the addresses for symbol resolution.For
gdb
, there is--offset
or-o
(I believe), forlldb
there is--slide
. See also my code and this StackOverflow post.Edit
The bootloader loads the kernel wherever it pleases. The boot…