* some questions about kernel debugging
@ 2010-07-09 11:52 loody
2010-07-09 13:07 ` Jan Kratochvil
0 siblings, 1 reply; 4+ messages in thread
From: loody @ 2010-07-09 11:52 UTC (permalink / raw)
To: gdb
Dear all:
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?
appreciate your help,
miloody
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some questions about kernel debugging
2010-07-09 11:52 some questions about kernel debugging loody
@ 2010-07-09 13:07 ` Jan Kratochvil
2010-07-09 15:56 ` loody
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2010-07-09 13:07 UTC (permalink / raw)
To: loody; +Cc: gdb
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some questions about kernel debugging
2010-07-09 13:07 ` Jan Kratochvil
@ 2010-07-09 15:56 ` loody
2010-07-09 16:20 ` Jan Kratochvil
0 siblings, 1 reply; 4+ messages in thread
From: loody @ 2010-07-09 15:56 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
hi:
thanks for your kind reply :)
2010/7/9 Jan Kratochvil <jan.kratochvil@redhat.com>:
> 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.
I tried compile the kernel with -O1 -g but it still fail.
does that mean only program compiled with -O0 -g will not get the
error message when trying to see the variable?
appreciate your help,
miloody
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some questions about kernel debugging
2010-07-09 15:56 ` loody
@ 2010-07-09 16:20 ` Jan Kratochvil
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2010-07-09 16:20 UTC (permalink / raw)
To: loody; +Cc: gdb
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-09 16:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-09 11:52 some questions about kernel debugging loody
2010-07-09 13:07 ` Jan Kratochvil
2010-07-09 15:56 ` loody
2010-07-09 16:20 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).