Advice on device driver debugging methods

mitaiwan82

Platinum Member
Nov 29, 2000
2,209
0
0
I have been writing a driver in Fedora Core 2 for a custom PCI device that I have made. The original driver that I have is written by a coworker, but it was written for a 2.4 kernel. I have made all the necessary changes in order to make it compile for a 2.6 kernel. The driver seems to work occasionally...it works when I first load the driver module, but eventually locks up/reboots the system whenever I try to read from the device.

I'm not experienced at writing drivers (or linux in general), so the only debugging I've been doing is reading the kernel messages at /var/log/messages. I'm running out of ideas for how to figure out why the driver is crashing my system, because it works perfectly in 2.4. Can any gurus point me in a good direction as where to go as far as debugging a device driver?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You'll most likely have to setup a serial console so that you can catch the errors, if any, before the reboot. Also you might want to look at the kdb patches, it's an in-kernel debugger that works sort of like gdb, but it's not in the base Linus tree. If the driver can load and still kill the machine without having access to the hardware, you could look at using UML, VMWare, etc to debug without rebooting your own box.
 

mitaiwan82

Platinum Member
Nov 29, 2000
2,209
0
0
Thanks Nothingman for your input. Loading this driver won't crash the machine...it's only when I try to access the hardware through the driver that the box would crash. Someone suggested UML to me in another forum, but I'm not even sure if that's necessary, since my machine is not for production (yet) and I'm free to use it as a development box (no ramifications for crashing it).
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
No, but it's probably a lot easier to debug when you can just attach gdb to the UML instance, but it sounds like that won't help you in this case.