Debugging / GDB issue when kernel is running

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
heavyweight87
Posts: 22
Joined: Sun Apr 28, 2019 7:39 am

Debugging / GDB issue when kernel is running

Post by heavyweight87 »

So I had debugging up and running with vscode and it worked great
Then I decided to make a move from the meaty skeleton makefile to CMake

Now for some strange reason I can only set breakpoints before the OS runs or whilst it is in another breakpoint
I also can't pause

If I put a breakpoint before startup I can single step and inspect data structures so I think my symbols are loaded correctly

The only way I can pause or add a breakpoint once the kernel runs is to put a stop command from QEMU

I cant find anything similar on the internet about this... is driving me nuts!
I went back to a previous commit where I was using the makefile and it works still...

Would really appreciate any help
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Debugging / GDB issue when kernel is running

Post by iansjack »

I can't see why the make system should change anything, but I've not tried debugging something produced with cmake. I gave up on VSCode debugging for the kernel as it seemed to have a number of problems, so I've gone back to gdb. If you need a gui debugger (which can be useful) you might like to check out ddd (a bit old-fashioned and clunky) or gdbgui (a browser-based interface, but you'll have to jump through a few hoops to debug a kernel, the most important being setting "target remote localhost:1234" in the gdb command window).
heavyweight87
Posts: 22
Joined: Sun Apr 28, 2019 7:39 am

Re: Debugging / GDB issue when kernel is running

Post by heavyweight87 »

The only real difference I see is that with the original system I had a .o and .d after building... with CMake I don't

But i did file mykernel.bin and it said that debug symbols were not stripped so I guess they are built in

I'll try those IDE suggestions...although it would be strange if its vscode making the problem

Its actually a pretty nice IDE...
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Debugging / GDB issue when kernel is running

Post by iansjack »

I like VSCode as an IDE for editing and building (particularly the fact that you can do remote work) even though it is a bit of a pain configuring some things. It's just the debugging that I find a bit iffy. The more I use gdbgui, the more I like it.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Debugging / GDB issue when kernel is running

Post by iansjack »

heavyweight87
Posts: 22
Joined: Sun Apr 28, 2019 7:39 am

Re: Debugging / GDB issue when kernel is running

Post by heavyweight87 »

I hadnt actually but it turns out my configuration was the same anyway
heavyweight87
Posts: 22
Joined: Sun Apr 28, 2019 7:39 am

Re: Debugging / GDB issue when kernel is running

Post by heavyweight87 »

thanks for the gdb gui recomendation - i really like it.

So it does work a bit better but I still can't get breakpoints or view source until I pause - but at least I can pause

Occasionally I get:

No gdb response received after 10 seconds.

Possible reasons include:

1) gdbgui, gdb, or the debugged process is not running.

2) gdb or the inferior process is busy running and needs to be interrupted (press the pause button up top).

3) Something is just taking a long time to finish and respond back to this browser window, in which case you can just keep waiting.

I have a feeling something is keeping GDB busy and it doesn't receive messages or something. Also when I quit the debug session with vscode it always told me timeout after 1000 ms
Post Reply