DebuggerTalk
ContentsBRTableOfContents |
Introduction
This topic is a bit overwhelming, so I'm open to suggestions for how to narrow and customize based on the audience desire. Basically though I am going to talk about the debuggers I've written or worked on for [http://bashdb.sf.net GNU bash], [http://bashdb.sf.net/remake GNU make], [http://bashdb.sf.net/pydb Python], and [http://rubyforge.org/projects/ruby-debug/ Ruby]. Topics can range from historical to practical.
In the practical arena, I could show how to use to debug an GNU automake project. There could be a theoretical area such as how to structure writing a debugger. (The ones for Ruby and Python are interesting here.)
In the past people have asked me in the past, "what's the fascination with the debugger thing?" Or another favorite remark from a contractor is I never use a debugger, I just write code. As a systems administrator one is often confronted with lots of code that you didn't write. You suspect the code might not even be written all that well, but you are more sure that there isn't much in the way of documentation or comments in the code. Here is where a debugger comes into play.
I've also heard the observation that you don't need a debugger because you go into a Python or Ruby shell and just start typing commands. Again if you have a high-level idea of what's going on, that's great. However the hardest part here is getting the context correct. I need a foo object from class Foo and then need to hook the bar object from class Bar into that before I can call this method that is of interest to me. With a debugger you work on code where that's all been done for you. So in a sense a good debugger is really not all that different than a shell, it's just that the context has already been set up for you. We'll see that in the Python debugger later.
[http://bashdb.sf.net GNU bash]
Historical stuff
The sordid history of trap DEBUG
Practical example
Using to debug start/stop scripts.
GNU make
I have a short (13 minute) [http://showmedo.com/videos/video?name=linuxBernsteinMakeDebug1&fromSeriesID=40 video] which is really the first part of a more extended example.
Historical stuff
Practical example
Debugging a automake-generated Makefile.
Python
Historical stuff
There are two gdb-like debuggers. The stock python debugger, [http://docs.python.org/lib/module-pdb.html pdb], and one that grew from that, called pydb. The name pydb is because at about the time pdb was developed Richard Wolff was working in parallel on a debugger to be embedded on [http://www.gnu.org/software/ddd ddd]. He has since retired and with his blessing I've taken over the name and have been sort of maintaining the ddd embedding as well.
Practical example
I have a short 15-minute [http://showmedo.com/videos/video?name=pythonBernsteinPydbIntro&fromSeriesID=28 video] showing off some non-pdb things.
Some relevant example will be used.
Recent and Future work
Integration into [http://ipython.scipy.org/moin/ ipython] was recently done. The imminent current release has better command completion, and [http://docs.python.org/lib/module-pydoc.html pydoc] help.
Remote debugging. Needed to hook into some IDE.
Ruby
There are in fact two ruby debuggers. "debug" and [http://rubyforge.org/projects/ruby-debug/ ruby-debug] by Kent Sibilev. Both are roughly gdb like. Kent's debugger is I think is coded the cleanest. Each command is its own class. I've been working with him to extend that along the lines of gdb.