[Dwarf-Discuss] Vendor extensions in .debug_macinfo

Michael Eager eager@eagercon.com
Wed Jul 20 17:16:10 GMT 2011

On 07/13/2011 11:20 AM, Jakub Jelinek wrote:
> Hi!
> The current .debug_macinfo format isn't very much extensible
> and is not really designed to allow reducing of duplicate debug
> info, so when compilers want to produce maco information, size
> of .debug_macinfo is prohibitive.
> We are discussing some extensions that would allow us to reduce
> the size of the macinfo hundredfolds while preserving all information
> it contains, see
> http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01070.html

Hi Jakub --

It took me a few days to review the current DWARF macinfo specification
and review this proposal.

The existing macro data format is clearly in need of revision.   I don't
think that there is any way to modify this format which would be transparent
and usable by a consumer which expected the current format.

I recommend that you create a new section to contain this data, perhaps
.debug_macinfo2 or .debug_macro.  Create a file header which includes at a
minimum a version number, similar to the other DWARF data sections.
This will give more flexibility in defining the contents of the section.

Define new macinfo opcodes as in your proposal (you can number them from 0x01).
Rather than using either the existing DW_MACINFO_vendor_ext opcode or your
DW_MACINFO_GNU_define_opcode for vendor extensions, I would define a vendor
extension range using the same *_lo_user and *_hi_user scheme used in other
parts of DWARF.  Actually, I would suggest that GCC not implement a vendor
extension scheme at this time, but wait until the DWARF committee has had an
opportunity to review the proposal and incorporate it into a future version
of DWARF.  Should you discover a need for an additional opcode, simply add
it to the implementation.

The DW_AT_macro_info attribute would be a section offset into either
.debug_macinfo or .debug_macro, depending on which was present.

I think that your modifications would be a significant improvement to DWARF.
Please submit a proposal at http://dwarfstd.org/Comment.php.

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

More information about the Dwarf-discuss mailing list