DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



120604.1 Jakub Jelinek Alternate debug sections Enhancement Defered Jakub Jelinek


BACKGROUND

Appendix E shows how DW_TAG_imported_unit can be used to reduce duplicate
information, but that allows only to reduce duplicate information within
debug information of each shared object or executable.  Often there is
quite a lot of debug information duplication also in between different
executables or shared objects (usually from the same project).

OVERVIEW

The following proposal adds 2 new forms and 3 new .debug_macro opcodes
that allow reducing duplicate information in between different
executables or shared objects.  Each executable or shared object then has
its own set of debug sections, and in addition to that there can be some
other object with another set of debug sections, which contain information
shared between several executables or shared objects.  How to find this
additional set of debug sections is implementation defined.

It has been implemented in th DWZ utility as a GNU extension.

The current forms used to reference information are references
within the same set of debug sections (same executable, same shared object
or from within the additional set of debug sections within that set).
The new forms allow references from the executable or shared object debug
sections to debug information within the additional set of debug sections.

PROPOSAL

Here are preliminary DWARF edits for the proposal (on top of the
.debug_macro proposal):

2.1

Add at the end:

"The debugging information entries that are the same in between multiple
 executables or shared objects may be also contained in alternate
 .debug_info and .debug_types sections in an extra object."

6.3.1
  Add:
  "DW_MACRO_define_indirect_alt		A macro definition.
   DW_MACRO_undef_indirect_alt		A macro undefinition.
   DW_MACRO_transparent_include_alt	Include a sequence of entries from given offset."

6.3.1.1
  Append:
  "All DW_MACRO_define_indirect_alt and DW_MACRO_undef_indirect_alt entries have
   two operands.  The first operand encodes the line number of the source
   line on which the relevant defining or undefining macro directives appeared.
   The second operand consists of an offset into a string table contained in
   the alternate .debug_str.  The size of the operand is
   given in the section header offset size.  Apart from the
   encoding of the second operand these entries are equivalent to
   DW_MACRO_define_indirect resp. DW_MACRO_undef_indirect."

6.3.1.4:
  Append:
  "A DW_MACRO_transparent_include_alt entry has one operand, offset from the
   start of the alternate .debug_macro section.  The size of the operand
   is given in the section header offset size.  Apart from the different
   location where to find the sequence of macinfo entries this entry type is
   equivalent to DW_MACRO_transparent_include.  This entry type is aimed
   at sharing duplicate sequences of macinfo entries between macinfo from
   different executables or shared objects.  From within alternate
   .debug_macro section, DW_MACRO_define_indirect and
   DW_MACRO_undef_indirect entry types refer to the alternate .debug_str
   section and DW_MACRO_transparent_include refers to the alternate
   .debug_macro section.".

6.3.3
  Replace
  "DW_MACRO_define, DW_MACRO_define_indirect, DW_MACRO_undef and DW_MACRO_undef_indirect"
  with
  "DW_MACRO_define, DW_MACRO_define_indirect, DW_MACRO_define_indirect_alt,
  DW_MACRO_undef, DW_MACRO_undef_indirect and DW_MACRO_undef_indirect_alt"
  and replace
  "DW_MACRO_define, DW_MACRO_define_indirect, DW_MACRO_undef or DW_MACRO_undef_indirect"
  with
  "DW_MACRO_define, DW_MACRO_define_indirect, DW_MACRO_define_indirect_alt,
  DW_MACRO_undef, DW_MACRO_undef_indirect or DW_MACRO_undef_indirect_alt"

7.4
  3. Add:
     "DW_FORM_ref_alt		offset in alternate .debug_info
     DW_FORM_strp_alt		offset in alternate .debug_str"

7.5.4
  "reference"
  Replace:
  "There are three types of reference."
  with:
  "There are four types of reference."

  After:
  "of the target executable or shared object"
  add:
  ", or, for references from within alternate .debug_info
  or .debug_types sections, an offset from the beginning of
  the alternate .debug_info section".

  After:
  "that was computed for the type"
  add:
  ".  The referenced type in a type unit might be present in any
  .debug_types section, either the executable or shared object's
  .debug_types section, or the alternate .debug_types section
  if present.

  The fourth type of recence is a reference from within the .debug_info
  or .debug_types section of the executable or shared object to
  a debugging information entry in the alternate .debug_info section.
  This type of reference (DW_FORM_ref_alt) is an offset from the beginning
  of the alternate .debug_info section".

  Replace:
  "second and third"
  with:
  "second, third and fourth".

  After:
  "across compilation units"
  add:
  ", the fourth type for sharing of information across compilation units
  from different executables or shared objects". 

  After:
  "(DW_FORM_strp)"
  add:
  "or may be represented as an offset into a string table contained in the
  alternate .debug_str section (DW_FORM_strp_alt).  DW_FORM_strp offsets
  from compilation units in alternate .debug_info or .debug_types sections
  refer to the alternate .debug_str section, not .debug_str in the
  executable or shared object".

  In figure 21 add:
  "DW_FORM_ref_alt	0x1a	reference"
  "DW_FORM_strp_alt	0x1b	string"

7.22
  In figure 39 add:
  "DW_MACRO_define_indirect		0x08
   DW_MACRO_undef_indirect		0x09
   DW_MACRO_transparent_include		0x0a"

E.1.3
  After the E.1.3 section add:
  "E.1.4  Using alternate debug information sections

  Further size reductions can be achieved by moving duplicate debug
  information entries, strings and macro entries from several executables
  or shared objects into another object file by some post-linking
  tool.  It is implementation defined how to find that another object
  file.  Debug information entries that refer to executable's or shared
  object's addresses shouldn't be moved, that will unlikely be beneficial
  as the addresses will be different, and similarly entries referenced
  from within expression locations or using loclistptr form attributes.

  Executable or shared object compilation or type units then can use
  DW_TAG_imported_unit with DW_FORM_ref_alt form DW_AT_import attribute
  to import entries from the alternate sections, other DW_FORM_ref_alt
  attributes to refer to them and DW_FORM_strp_alt form attributes to
  refer to strings that are used by debug information of multiple
  executables or shared objects.

  In macro information DW_MACRO_define_indirect_alt or
  DW_MACRO_undef_indirect_alt opcodes can refer to strings in the alternate
  .debug_str section, or DW_MACRO_transparent_include_alt can refer
  to alternate .debug_macro section opcodes.  Within the alternate
  .debug_macro section, DW_MACRO_define_indirect and DW_MACRO_undef_indirect
  opcodes refer to the alternate .debug_str section, not the one in
  the executable or shared object."

--

Defered -- 1/21/2014 -- depends on 110722.1.


All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2013 by DWARF Standards Committee.