some questions about kernel debugging

Jan Kratochvil
Fri Jul 9 13:07:00 GMT 2010

On Fri, 09 Jul 2010 13:52:31 +0200, loody wrote:
> I enable kernel hacking options about kernel debugging on my mips platform.
> I can successfully connect to the target board.
> My question is:
> 1. why I cannot p/x the value of variable?
>     but I still get the message which tell me "value optimized out".
>     did I miss anything?
>     my kernel version is

This is not a GDB problem, you should report it to GCC (you need a minimal
reproducer for the bugreport).

The problem is Linux kernel cannot (at least could not) compile with -O0, it
requires -O2 to successfully build.  -O2 was always mostly unsupported
together with -g (=debuggingo information).  For -O2 -g you should use the
latest GCC - SVN HEAD best - and definitely at least 4.5 (for VTA
- var-tracking-assignments).

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.


More information about the Gdb mailing list