Debuglocus
(Sometimes also referred to as debugalicious :-)
This is an experimental branch for an approach to track debug information.
The premise is simple enough: A user decl (aka debug decl) is associated with a statement, expression, or insn which defines that decl's value. As these statements, expressions, and insns are manipulated and optimized, the debug decl is simply moved around with it. The name originates from the observation that the source location field (often referred to as a 'locus') is carried around by all these items already, and the initial implementation will try to tie the debug decl to the source locus field. Thus, 'debuglocus'.
This document provides an overview of the general approach of debuglocus : debuglocus.odt or debuglocus.pdf
The main attractions are
- There is little maintenance impact to any other part of the compiler.
- Generation of debug symbols does not depend on the symbol which appears on the statement as is does today.
- Tracks values of variable which have been optimized away, including inlined parameters.
- The code generation path does not change with debug info, so code generation cannot be affected
This document is really more of an executive overview, with the initial stage enhanced with some implementation details which were worked out with a prototype. As such, most of the information is intended to provide a flavour of how things work and relate to each other rather than a detailed implementation guide. Much of it is over-simplified simply for ease of description, and some is already out of date.
The branch has been created as of mid march, and the basic infrastructure work will be done over the coming months to enable the remaining aspects of the design to be finished. The challenges are primarily related to dealing with expression which are optimized away, as well as some rather indifferent treatment of the locus field in many places. The results will then be assessed and we can determine whether this is a feasible approach worth pursuing further, or whether it has too many limitations or shortcomings to bother with.