Sponsored Content
Top Forums UNIX for Advanced & Expert Users Can KGDB debug a device driver? Post 302568261 by liklstar on Thursday 27th of October 2011 12:05:47 AM
Old 10-27-2011
How can I watch the running details of a kernel function?

Hi:

Thanks! But my program is also a kernel device driver module and isn't a process!

What should I do to watch the running details of a kernel function called in my own driver? Especially the driver initalization codes such as "register_netdev()" function. My linux kernel is 3.0.4 and KGDB enabled. Two PC linked by serial cable on serial port are there for debugging.


li, kunlun

---------- Post updated at 10:36 PM ---------- Previous update was at 09:12 PM ----------

Following are my actual methord of debugging into my own driver module from kernel:

at development end for example:

(gdb) br do_one_initcall
/*it will reply information such as "fn=0xd0a5c020", for example*/

(gdb)add-symbol-file path/to/rtl8139_driver.ko 0xd0a5c000
/*the address is geted from above fn-0x20*/

(gdb)hb 0xd0a5c000

when continue to the hard break, debugger can step into my driver module from kernel.

My question is whether this methord is right or not? What is the best or right methord?


thanks!
li, kunlun

---------- Post updated at 11:05 PM ---------- Previous update was at 10:36 PM ----------

(gdb) info br
Num Type Disp Enb Address What
1 breakpoint keep y 0xc0101104 in do_one_initcall
at init/main.c:671
breakpoint already hit 1 time
(gdb) n
671 in init/main.c
(gdb) n
668 in init/main.c
(gdb) s
671 in init/main.c
(gdb) n
674 in init/main.c
(gdb) step

Program received signal SIGSEGV, Segmentation fault.
0xf3983128 in ?? ()
(gdb)



and the related source code is here:

666 int __init_or_module do_one_initcall(initcall_t fn)
667 {
668 int count = preempt_count();
669 int ret;
670
671 if (initcall_debug)
672 ret = do_one_initcall_debug(fn);
673 else
674 ret = fn();


my linux kernel is 3.0.4;

Is there anyone who have any idea?
 

5 More Discussions You Might Find Interesting

1. Solaris

SUNWglmr -- rasctrl environment monitoring driver for i2c or SCSI device driver ?

I've been researching minimizeing Solaris 8 and found that on the web page http://www.sun.com/bigadmin/content/packagelist/s8u7PkgList/p2.html the package SUNWglmr is listed as "rasctrl environment monitoring driver for i2c, (Root) (32-bit)" while in the document "Solaris 8 minimize-updt1.pdf"... (1 Reply)
Discussion started by: roygoodwin
1 Replies

2. Programming

Network device driver

HI, I am writing a network device driver for RTL8139c card on 2.6.18 kernel ... I am facing few queries listed below 1. Can i able to at all write a driver for RTL8139C or Realtek had designed new chip for 2.6 series kernel? 2. If no then which driver file 2.6.18 uses .. Is it 8139too.c or... (1 Reply)
Discussion started by: niketan
1 Replies

3. UNIX for Advanced & Expert Users

help regarding device driver

Hi All, I have a device driver that uses UARTserial port to write/read to-from a device. That device driver is working fine on FC3 machine( kernel version 2.6.12)... Now I am switching to FC9 (kernel version 2.6.25.11-97).I have changed the interrupt flag SA_INTERRUPT to IRQF_DISABLED... (0 Replies)
Discussion started by: rajuprade
0 Replies

4. Programming

regarding device driver

Hi All, I have a device driver that uses UARTserial port to write/read to-from a device. That device driver is working fine on FC3 machine( kernel version 2.6.12)... Now I am switching to FC9 (kernel version 2.6.25.11-97).I have changed the interrupt flag SA_INTERRUPT to IRQF_DISABLED... (0 Replies)
Discussion started by: rajuprade
0 Replies

5. What is on Your Mind?

Device driver programming

I want to work one day as a device driver programmer, OS I'm in love is Solaris :D I am learning C in my free time which I don't have because college took my life and I need to study to pass. In college we work in C++ / Java. These languages aren't inteded for device driver programming , saying... (0 Replies)
Discussion started by: solaris_user
0 Replies
All times are GMT -4. The time now is 10:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy