u/OstrichWestern639in r/osdev • Recommends
On “osdev debugging”
General GDB info: link to this video
Debugging linux kernel: link to this video
I know you are asking for your own kernel and not linux. But the principles remain the same.
Make sure you compile your OS with -g option to include debugging symbols.
Once you compile it, run:
gdb ./path-to-kernel-object-file -ex “target remote localhost:1234”
This should connect you with your kernel. Add break points and run. (Look at GDB tutorial)
The way you can debug faults is kinda tricky… you can code your kernel in a way to enter panic() when such things happen.
Breakpoint at panic() and backtrace. But there are other methods too, like manually checking where the faults happening.
Ill let others explain this part:)