Re: Changing path in kernel object & Debug of Kernel module with gdb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/6/09, Microbit_Ubuntu <microbit@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> 2. As referred to in the u32 previous post, I'm a bit stumped how to
>    invoke GBD on debugging kernel modules.
>    Do I need a separate "pre-command" from the debugger, launching
>    insmod, or some such ?

What do you want to debug against your kernel module? decoding oops
message? tracking the code flow?

Maybe what you need to do is setup virtual environment first e.g using
Qemu. Put your kernel module inside the guest image and run Qemu plus
enable its gdb stub.

After that, insert your module inside the guest using normal insmod
command. The trick here is, assuming you want to stop at module init
function, how to stop exactly when entering it while its symbol is
still not resolved 'til the moment it is loaded?

Check the following stack trace:
[278057.822340]  [<e02b6018>] hi+0x8/0x44 [mymodule]
[278057.822353]  [<c0401152>] do_one_initcall+0x65/0x172

"hi" is module_init function ( I steal that from Robert Day's article,
sorry Robert...). So as you can see, put breakpoint in
do_one_initcall(). Once it is hit, it means all the symbols of the
module are resolved already... and for the rest of the work...you know
what to do :)

Please CMIIW people....
-- 
regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux