This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fwd: some questions about kernel debugging


loody <miloody@gmail.com> writes:

> Is there another way to p/x variables of kernel except I re-compile
> the it with the latest GCC?

For a real answer you have to give us an example.

If you are talking about a local variable, then, as Jan said, they are
often unavailable when compiling with optimization.  Even recompiling
with current gcc may not help, as if the variable has been optimized
away then there is really nothing to print.

Ian

> ---------- Forwarded message ----------
> From: Jan Kratochvil
> Date: 2010/7/9
> Subject: Re: some questions about kernel debugging
> To: loody
>
>
> 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?
>> Â Â I have enabled CONFIG_ARCH_WANT_FRAME_POINTERS and CONFIG_FRAME_POINTER
>> Â Â but I still get the message which tell me "value optimized out".
>> Â Â did I miss anything?
>> Â Â my kernel version is 2.6.30.9?
>
> 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.
>
>
> Regards,
> Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]