Providing a clear and correct source-level debugger for
programmers to debug highly optimized code has become a necessity
with executable binaries increasingly generated by compilers which
incorporate advanced optimization techniques. Implementing source
breakpoints is essential for providing such a debugger. In this
paper, a novel source breakpoint implementation scheme for debugging
optimized code is proposed. The approach is aimed at solving the
fundamental problem suffered by the traditional scheme. By taking
over the control early and executing instructions under a new
forward recovery model, the debugger can preserve and gather the
required program states. With this information accumulated and
the help of a data location tracking method, the expected values
of user variables can be recovered at source breakpoints. In order
to facilitate this new breakpoint implementation scheme, additional
information needs to be generated and maintained during compilation.
The compiler support for our approach is also described.