GDB with PIE kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Scoopta
Member
Member
Posts: 26
Joined: Tue Jun 13, 2017 3:17 am
Libera.chat IRC: Scoopta

GDB with PIE kernel

Post by Scoopta »

I have a position independent kernel and when I map the kernel into high memory and then jump to it gdb loses track of the source code for the executable making debugging difficult. Is there some way for me to have GDB attach the kernel in high memory to the source code?
Scoopta
Member
Member
Posts: 26
Joined: Tue Jun 13, 2017 3:17 am
Libera.chat IRC: Scoopta

Re: GDB with PIE kernel

Post by Scoopta »

I went and asked on stackoverflow, if anyone else comes across this topic the way you deal with it is to run

Code: Select all

symbol-file
in GDB to clear the existing symbols followed by

Code: Select all

add-symbol-file /path/to/kernel 0x...
where 0x... is the address of your .text section after the remap.
Post Reply