Thank you so much. When I insert kgdb_breakpoint(); into resume path,
now I can connect to the kernel using gdb.

This is absolutely great : )


On Wed, Oct 6, 2010 at 7:24 AM, Jason Wessel <[email protected]> wrote:
> On 10/05/2010 07:27 PM, Thawan Kooburat wrote:
>> Hi,
>>
>> I am using kernel 2.6.35.5 and I am trying to debug the kernel while
>> it is resuming from hibernate (using TuxOnIce).
>>
>> I am able to attach gdb to the "boot" kernel and trace its operations
>> normally. However, when the boot kernel finished restoring the
>> "resume" kernel, gdb seems to lose track of the kernel and I can no
>> longer use gdb after this point.
>>
>> The boot kernel restore the resume kernel by loading it from a disk.
>> When it ready to "jumps" into the resume kernel, it will relocate
>> resume kernel's memory pages over itself. I guess that this is the
>> reason why I cannot use gdb after the resume kernel start executing.
>>
>> Is it possible to insert kgdb_breakpoint(); into kernel's resume path?
>> so that I can attach gdb as soon as the resume kernel start executing.
>>
>
> I would assume you can, you probably just need the address.  Also you
> could force the kernel into the kernel debugger in the resume path by
> simply compiling in a breakpoint, or making a kprobe that installs a
> breakpoint in the worst case scenario.
>
> To do so:
>
> #include <linux/kgdb.h>
>
> void some_resume_function(void)
> {
> ...
> kgdb_breakpoint();
> ...
> }
>
>> I am working inside KVM and I can still get printk() message via
>> virtual serial port as soon as the resume kernel comes back. Does this
>> means that there is enough I/O facility for KGDB to start working at
>> this point?
>>
>
> If you can see printk messages, enough of the kernel is alive that you
> would be able to use the kernel debugger.
>
> If you are doing this work on x86, you want to consider using hardware
> instruction breakpoints instead of software breakpoints if you are
> moving pages of the kernel around, because a software breakpoint works
> with instruction replacement and pages that get copied over pages will
> erase the breakpoints.  In gdb you can use "hbreak" instead of "break"
> for a hardware instruction breakpoint.
>
> And of course.  Good luck with your debugging. :-)
>
> Cheers,
> Jason.
>



-- 
Thawan Kooburat

Graduate Student
Department of Computer Science
UW-Madison

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to