Quick links

A Retargetable Debugger (Thesis)

Report ID:
December 1992
Download Formats:


Debuggers are specific to the machines, operating systems, and
languages that they support. Much of a debugger has to be
re-implemented for each new machine, so debuggers that work with a
variety of machines and operating systems can get unwieldy.
Improvements to debuggers may be lost unless they are re-implemented
as users move to new machines. If retargeting debuggers were easier,
other improvements would be more valuable. This thesis describes the
design and implementation of { t ldb}, a prototype retargetable
debugger. Dealing with symbol-table formats is one of the most
machine-dependent aspects of debuggers. { t ldb} eliminates this
machine dependence by using one format on all machines. The format is
a language---a dialect of PostScript, which is extensible and can
represent procedures. { t ldb} reduces retargeting effort associated
with variations in run-time support by controlling its target process
using a debug nub, which is a small piece of object code linked with
the target program. Much of a debugger's job is to undo what the
compiler has done or to do what the compiler could do, but at run
time. For example, to print the value of a variable, the debugger
must undo the compiler's mapping of source-level data to the machine
level. To evaluate an expression, the debugger must check that it is
syntactically and semantically correct and translate it into an
executable form. { t ldb} makes the compiler do as much of this work
as possible. The compiler emits PostScript that { t ldb} uses to
print values. A variant of the compiler runs at debug time and
compiles expressions into other PostScript, which { t ldb} uses to
evaluate the expressions. Debugging tasks like planting breakpoints
and walking the call stack have no analogs in a compiler. { t ldb}
reduces retargeting effort for these tasks by using layers of
abstraction to minimize machine-dependent code, which is confined to
the innermost layers. These techniques produce a debugger with little
machine-dependent code. { t ldb}'s total code size is about
15,000~lines of Modula-3 and~C, but it needs no more than 550~lines of
machine-dependent code for any of its 4~targets.

Follow us: Facebook Twitter Linkedin