public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Questions Regarding DWARF
@ 2011-09-08  1:59 Kevin Polulak
  2011-09-08 13:13 ` Andi Kleen
  2011-09-08 15:09 ` Michael Eager
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Polulak @ 2011-09-08  1:59 UTC (permalink / raw)
  To: GCC Mailing List

Howdy,

I'm a contributor to the Parrot project which is a virtual machine for
dynamic languages including Perl 6. One of the problems we've been
facing is that the bytecode does not contain a debug segment for
preserving high-level information about the original source code.
Therefore, I've begun work on a watered-down version of DWARF to help
fill this gap. Designing the format itself has been fairly easy but
now I must consider the actual implementation.

That is why I've come to you guys. Considering that GCC supports
several debug formats (including DWARF), I figured that the GCC
Project would be the best place to inquiry about a few design issues.

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.

I've tried to gain some knowledge by digging through the GCC source
but haven't come up with much other than the values of the DW_*
constants which isn't that important. Are there any files in
particular I should be looking at?

If any of you are DWARF experts, I would really appreciate your advice.

Thanks for the help!

--
- Kevin Polulak (soh_cah_toa)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Questions Regarding DWARF
  2011-09-08  1:59 Questions Regarding DWARF Kevin Polulak
@ 2011-09-08 13:13 ` Andi Kleen
  2011-09-08 15:09 ` Michael Eager
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2011-09-08 13:13 UTC (permalink / raw)
  To: Kevin Polulak; +Cc: GCC Mailing List

Kevin Polulak <kpolulak@gmail.com> writes:
>
> I've tried to gain some knowledge by digging through the GCC source
> but haven't come up with much other than the values of the DW_*
> constants which isn't that important. Are there any files in
> particular I should be looking at?

From the gcc internals manual:

 * Debugging information output

     This is run after final because it must output the stack slot
     offsets for pseudo registers that did not get hard registers.
     Source files are `dbxout.c' for DBX symbol table format,
     `sdbout.c' for SDB symbol table format, `dwarfout.c' for DWARF
     symbol table format, files `dwarf2out.c' and `dwarf2asm.c' for
     DWARF2 symbol table format, and `vmsdbgout.c' for VMS debug symbol
     table format.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Questions Regarding DWARF
  2011-09-08  1:59 Questions Regarding DWARF Kevin Polulak
  2011-09-08 13:13 ` Andi Kleen
@ 2011-09-08 15:09 ` Michael Eager
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Eager @ 2011-09-08 15:09 UTC (permalink / raw)
  To: gcc, kpolulak

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	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-08 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08  1:59 Questions Regarding DWARF Kevin Polulak
2011-09-08 13:13 ` Andi Kleen
2011-09-08 15:09 ` Michael Eager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).