[vox-tech] Kernel debugger
Eric W. Nelson
vox-tech@lists.lugod.org
Thu, 23 May 2002 19:02:28 -0700
On Thursday 23 May 2002 02:59 pm, you wrote:
> nicole,
>
> aside from jeff and rod's excellent suggestions (whoa!), here's some
> more:
>
> depending on what you're debugging, and the details, you may want to use
> a combination of /proc files and printk()'s. i think you'll find it
> **much** easier for simple debugging purposes. all the debuggers i know
> of require kernel patches and wierd serial connections. printk() and in
> particular, /proc, are easy to use and available immediately.
>
> nota bene with using printk in tight loops:
>
> if your code has some tight loops which you want to debug by printk, go
> to /etc/syslog.conf and put the name of your log file with a "-" in
> front of it so that printk doesn't keep syncing the disk (which is the
> default behavior and the right thing to do from syslog's point of view,
> but can be a nuisance from a coder's point of view). the issue is that
> a sync for every printk() can slow your system down. this won't be a
> problem for most code, though. this is also why /proc is a good thing
> to use for debugging -- no disk access at all.
>
> i once read that the reason why the linux kernel doesn't contain an
> internal interactive debugger is because linus doesn't believe in
> debuggers. his point of view is that fixing code using a debugger is
> more of a "fix the symptom" type of programming rather than "addressing
> the real cause of the problem. this is word of mouth from alessandro
> rubini, a prominent kernel hacker. pretty wacky if you ask me, but who
> am i to argue kernel programming with linus? i'd just as soon argue
> programming with knuth.
>
> i've never used an kernel debugger, but i've read about them...
>
> there are a few options that i know of:
>
> kdb - a non-official interactive debugger. widely used.
> IKD - interactive kernel debugger. this is a kernel patch that embeds a
> kernel debugger.
> kgdb patch - don't know much about this, but apparently it allows you to
> use plain old gdb on a kernel. i think you need to use it over a
> serial line, which makes it kind of wonky.
>
I have set up kgdb, and will be using it soon. One problem with it is you
have to compile the serial module into the kernel. Since we will be hacking
serial.o, that presents a problem. But, I applied the patch, and started it,
and it seemed to run OK. I think you can use ddd on top of it to get a gui
interface. Be sure to check the latest version of the patch, 2.4.10 last
time I looked, so you apply it to that kernel.
Have any of you used kdb or IKD?
>
> hope something in here was useful...
>
> pete (who should be doing physics right now...)
>
>
> begin Nicole Carlson <nmcarlson@ucdavis.edu>
>
> > Hi guys
> >
> > Can anyone recommend a good kernel debugger? I have module code to
> > debug.
> >
> > Thanks
> >
> > --nicole twn
> >
> > ***
> > "This is a very hard class. The projects are hard. The homeworks are
> > hard. You should all drop this class."--my networks professor
> > Visit Nicolopolis! http://wwwcsif.cs.ucdavis.edu/~carlsonn
> > nmcarlson@ucdavis.edu ana.ng@tmbg.org carlsonn@seclab.cs.ucdavis.edu
> >
> > _______________________________________________
> > vox-tech mailing list
> > vox-tech@lists.lugod.org
> > http://lists.lugod.org/mailman/listinfo/vox-tech
>
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech