kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* RE: How can I debug kernel module running on a virtual machine?
@ 2022-04-05 14:03 Chan Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Chan Kim @ 2022-04-05 14:03 UTC (permalink / raw)
  To: 'qemu-discuss', kernelnewbies

Hello all,

I found how to do it, I had asked it on stackoverflow.com and posted it as
an answer there.
Please see if you are interested. 
https://stackoverflow.com/questions/71749640/how-can-i-debug-kernel-module-r
unning-on-a-virtual-machine/71753139#71753139
Thank you!

Chan Kim


> -----Original Message-----
> From: Chan Kim <ckim@etri.re.kr>
> Sent: Tuesday, April 5, 2022 6:54 PM
> To: 'qemu-discuss' <qemu-discuss@nongnu.org>;
> kernelnewbies@kernelnewbies.org
> Subject: How can I debug kernel module running on a virtual machine?
> 
> Hello all,
> 
> I think I have once read about this but can't find it now.
> I'm running linux-5.4.188 on a qemu arm64 virtual machine. Because I built
> the kernel from the source, I can debug(analyze) the kernel by attaching
> to the linux kernel program running on a remote machine(qemu virtual
> machine). To test an application which uses our device(the device model is
> in qemu too), I compiled a device driver against kernel 5.4.188 and the
> linux application and can do insmod the driver and run the application.
> Now something is wrong and I have panic while running the application. I
> can debug linux kernel itself, but I don't know where the kernel module
> was loaded, so the debugger cannot debug the driver module. How can I
> debug the device driver? (or even the application? in case I need to
> someday). I remember by first getting the loaded address of the kernel
> module, and doing add-symbol-file for the driver image relative to that
> loaded address, it is possible to do kernel module debug. I think this is
> what driver developers will be doing always.  Please tell me how I can do
> it. If this is possible, it will save many days for me.
> 
> Thank you!
> Chan Kim





_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* How can I debug kernel module running on a virtual machine?
@ 2022-04-05  9:53 Chan Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Chan Kim @ 2022-04-05  9:53 UTC (permalink / raw)
  To: 'qemu-discuss', kernelnewbies

Hello all,

I think I have once read about this but can't find it now.
I'm running linux-5.4.188 on a qemu arm64 virtual machine. Because I built
the kernel from the source, I can debug(analyze) the kernel by attaching to
the linux kernel program running on a remote machine(qemu virtual machine).
To test an application which uses our device(the device model is in qemu
too), I compiled a device driver against kernel 5.4.188 and the linux
application and can do insmod the driver and run the application.  
Now something is wrong and I have panic while running the application. I can
debug linux kernel itself, but I don't know where the kernel module was
loaded, so the debugger cannot debug the driver module. How can I debug the
device driver? (or even the application? in case I need to someday). I
remember by first getting the loaded address of the kernel module, and doing
add-symbol-file for the driver image relative to that loaded address, it is
possible to do kernel module debug. I think this is what driver developers
will be doing always.  Please tell me how I can do it. If this is possible,
it will save many days for me. 

Thank you!
Chan Kim





_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-05 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 14:03 How can I debug kernel module running on a virtual machine? Chan Kim
  -- strict thread matches above, loose matches on Subject: below --
2022-04-05  9:53 Chan Kim

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 NNTP newsgroup(s).