some questions about kernel debugging

Jan Kratochvil
Fri Jul 9 16:20:00 GMT 2010

On Fri, 09 Jul 2010 17:56:35 +0200, loody wrote:
> 2010/7/9 Jan Kratochvil <>:
> > Besides resolving this -O2 -g problem at GCC the easy way is always to just
> > `disassemble' the code in GDB, guess from the code+source in which
> > register/memory is the value probably located and access it directly there.
> I tried compile the kernel with -O1 -g but it still fail.

-O1 should be like -O2 for the debugging...

> does that mean only program compiled with -O0 -g will not get the
> error message when trying to see the variable?

Right.  If you succeed to build Linux kernel with -O0 -g (which I doubt) then
GCC should produce correct enough debug information that GDB will be happy.


More information about the Gdb mailing list