On 09/07/2011 06:59 PM, Kevin Polulak wrote:

I'd like to know at what stage during compilation is debug data
collected and subsequently stored in the object file? Is it a
multi-stage process? Perhaps the parser collects some high-level
information which passes it to the code generator for further analysis
which passes it again to the linker/loader for even further low-level
analysis? Or is there a single stage dedicated to collecting debug
data; perhaps after linking? I envisioned it as a multi-stage process
but I don't want to make any assumptions.

Debug information is collected at various times, although it isn't
always identified specifically as such.  For example, variable and
type info is collected as symbol data as the program is parsed and
is used in code generation as well as generating debug data.
Information about generated code is collected during as the code is
created, in several places.  This is translated into debug data after
code generation.  There are external references in the data which are
resolved by the linker.

So, yes, it is a multi-stage process which is distributed throughout
the compilation process.  Although the generation of debug data in the
object files is localized in format-specific routines, actual collection
of the data is more implicit than explicit.

--
Michael Eager    ea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

Reply via email to