This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: some questions about kernel debugging
On Fri, 09 Jul 2010 17:56:35 +0200, loody wrote:
> 2010/7/9 Jan Kratochvil <jan.kratochvil@redhat.com>:
> > 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.
Regards,
Jan