Skip to content

GDB debugging with edition 3? #1379

Discussion options

You must be logged in to vote

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 giving gdb your symbols file, and invoke b main.rs:281. This resolves to address 0x43652 in the symbols file. gdb (or QEMU) will now pause when the instruction pointer hits 0x43652.

The problem is, that your kernel is not loaded at 0x00, but at 0xffff_fff8_0000_0000 (or somewhere in that area). You have to tell gdb to always add that offset to the addresses for symbol resolution.

For gdb, there is --offset or -o (I believe), for lldb there is --slide. See also my code and this StackOverflow post.

Edit

The bootloader loads the kernel wherever it pleases. The boot…

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
11 replies
@ChocolateLoverRaj
Comment options

@tsatke
Comment options

Answer selected by ChocolateLoverRaj
@tsatke
Comment options

@ChocolateLoverRaj
Comment options

@bjorn3
Comment options

@tsatke
Comment options

Comment options

You must be logged in to vote
3 replies
@ChocolateLoverRaj
Comment options

@bjorn3
Comment options

@ChocolateLoverRaj
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants