Debugging multithreaded kernel with GDB
Posted: Sat Apr 10, 2010 4:19 pm
Hi,
I just finished my scheduler Until now everything is hardcoded, but it works. It prints happily A's and B's.
The thing I noticed is that GDB gets quite confused about this. I'm running my kernel in qemu with 1 CPU.
I'm attaching GDB, setting the breakpoint to my main function where nothing is initialized yet and the kernel executes the kernel thread. Only my second thread seems to be paused. At the time the instruction pointer should hit the breakpoint no scheduling should be initialized.
I also tried to debug the multitasking sample from James Molloy and the behaviour is the same. I needed some inspiration how to do the actual task switching, so the core mechanisms are the same in both kernels.
This is the strange behaviour: The kernel thread itself outputs the B's.
Does anybody know what's happening there and how to get rid of it?
I just finished my scheduler Until now everything is hardcoded, but it works. It prints happily A's and B's.
The thing I noticed is that GDB gets quite confused about this. I'm running my kernel in qemu with 1 CPU.
I'm attaching GDB, setting the breakpoint to my main function where nothing is initialized yet and the kernel executes the kernel thread. Only my second thread seems to be paused. At the time the instruction pointer should hit the breakpoint no scheduling should be initialized.
I also tried to debug the multitasking sample from James Molloy and the behaviour is the same. I needed some inspiration how to do the actual task switching, so the core mechanisms are the same in both kernels.
This is the strange behaviour: The kernel thread itself outputs the B's.
Does anybody know what's happening there and how to get rid of it?