DBUG by Fred Fish (a macro based C debugging package)

DBUG is an example of an internal debugger, because it requires internal instrumentation of a program

Monty has made it thread-safe and uses it to debug MySQL. It looks like a good way to debug kernel-based LinuxThreads for which gdb is of no help.

Quick summary of the capabilities:
  1. Execution trace showing function level control flow in a semi-graphical manner using indentation to indicate nesting depth.
  2. Output the values of all, or any subset of, key internal variables.
  3. Limit actions to a specific set of named functions.
  4. Limit function trace to a specified nesting depth.
  5. Label each output line with source file name and line number.
  6. Label each output line with name of current process.
  7. Push or pop internal debugging state to allow execution with built in debugging defaults.
  8. Redirect the debug output stream to standard output (stdout) or a named file.
  9. Performance profiling.

With performance profiling turned on DBUG produces a trace file which can be fed into an analysis program. It produces a summary listing which includes:
  1. the name of each traced function,
  2. the number of times it was called,
  3. the percentage of total calls,
  4. the time spent executing the function,
  5. the proportion of the total time and
  6. the 'importance'.
The last is a metric which is obtained by multiplying the proportions of calls and the proportions of time for each function. The greater the importance, the more likely it is that a speedup could be obtained by reducing the time taken by that function.

To use it, you'll need to get MySQL and extract it. Maybe someone could make a standalone distribution :^)

DBUG licensing, credits and history:
  1. Fred Fish released the DBUG package 1987 to the public domain. Very nice of him :)
  2. Binayak Banerjee made a profiler available for this 1989, also in the public domain.
  3. Monty did many speed improvements, made it more portable (works even in MSDOS), added a few new options, added the _db_dump function and made it thread safe. All his changes are also in the public domain.


If you have comments or suggestions, email me at sdybiec@humanfactor.com