Oct 99 KoolTools
Volume Number: 15
Issue Number: 10
Column Tag: KoolTools
KoolTools
Introducing DCon
by Matt Slot, Ambrosia Software
Bugs Check In, But They Don’t Check Out
DCon, the"Debugging Console," brings the joy of printf() based debugging to the
MacOS. Yes, that's right, I said joy. Sometimes you just need to examine a few key
variables from a given function while your application is running. Under UNIX or DOS
you would simply print those values to the console, but it hasn't been so easy for Mac
programmers. Until now.
There are alot of sophisticated debugging tools on the market today, so why would
anyone use 1980's technology to debug a modern application? Probably because it's
still effective for finding some of the most elusive bugs. Wrap a troublesome piece of
code with markers, and you can tell if the application reaches one or both successfully.
If you do this several times in a row (known as "binary partitioning"), you can
narrow down memory corruption or crashing bugs to a given function or block of code.
Listing 1:
Binary Partitioning
Test whether this function executes properly by adding calls to
dprintf() before and after the body of the function. At the end,
return the result code indicating whether the function succeeded or
why it failed.