[SOLVED] gdb driving me crazy...

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
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

[SOLVED] gdb driving me crazy...

Post by turdus »

So I've downloaded the latest TianoCore ROM and with that I had many problems. No LoadedImageProtocol and no GOP... I've fixed all issues in my bootboot.efi loader (using uefi_call_wrapper directly instead of gnu-efi's LibHandleProtocol seems do the trick with LoadedImageProtocol, and falling back to UGA helps in lack of GOP). But my kernel still triple-faults at some very early stage. So I've decided to debug. And imagine the surprise, when I've realized that I can't. I've spend endless hours figuring out why gdb doesn't honor breakpoints.

Code: Select all

(gdb) break *0xffffffffffe020a9
Breakpoint 1 at 0xffffffffffe020a9
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
0xffffffffffe020ba in _start ()
1: x/i $pc
=> 0xffffffffffe020ba <_start+58>:	jmp    0xffffffffffe020ba <_start+58>
(gdb) set $pc+=2
(gdb) x/i $pc
=> 0xffffffffffe020bc <_start+60>:	xor    %rsp,%rsp
(gdb) si
Here gdb does not return to the debugger prompt.

If somebody else has the same problem, "program is no longer writeable" error is caused by kvm module enabled in qemu. Without kvm it's works like charm, now I just have to figure out why "layout source" doesn't work... :-)

"Computers are only to solve problems that wouldn't exist without computers"
So true...
User avatar
iocoder
Member
Member
Posts: 208
Joined: Sun Oct 18, 2009 5:47 pm
Libera.chat IRC: iocoder
Location: Alexandria, Egypt | Ottawa, Canada
Contact:

Re: [SOLVED] gdb driving me crazy...

Post by iocoder »

turdus wrote:So I've downloaded the latest TianoCore ROM and with that I had many problems. No LoadedImageProtocol and no GOP... I've fixed all issues in my bootboot.efi loader (using uefi_call_wrapper directly instead of gnu-efi's LibHandleProtocol seems do the trick with LoadedImageProtocol, and falling back to UGA helps in lack of GOP). But my kernel still triple-faults at some very early stage. So I've decided to debug. And imagine the surprise, when I've realized that I can't. I've spend endless hours figuring out why gdb doesn't honor breakpoints.

Code: Select all

(gdb) break *0xffffffffffe020a9
Breakpoint 1 at 0xffffffffffe020a9
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
0xffffffffffe020ba in _start ()
1: x/i $pc
=> 0xffffffffffe020ba <_start+58>:	jmp    0xffffffffffe020ba <_start+58>
(gdb) set $pc+=2
(gdb) x/i $pc
=> 0xffffffffffe020bc <_start+60>:	xor    %rsp,%rsp
(gdb) si
Here gdb does not return to the debugger prompt.

If somebody else has the same problem, "program is no longer writeable" error is caused by kvm module enabled in qemu. Without kvm it's works like charm, now I just have to figure out why "layout source" doesn't work... :-)

"Computers are only to solve problems that wouldn't exist without computers"
So true...
Try to debug gdb itself using gdb.
Post Reply