> I'm currently working on migrating debugging information for Ada from GNAT > encodings to standard DWARF. At the moment, I have worked on two topics that > I believe are not (completely) supported in standard DWARF: > > - fixed point types with arbitrary scale factors; > - scalar types with biased representations. > > My goal is to submit an issue on dwarfstd.org in an attempt to introduce > these extensions to the next DWARF standard. Before that, though, I would > like to make sure that these extensions actually fit the need by having them > supported both in GCC and GDB. > > The two attached patches make these extensions "public" so that no other > vendor-specific tags/attributes conflict with them in the future. I cannot > submit the patches that actually use these right now because I need first to > port them from the 4.9 branch onto mainline (I hope I will be able to do > this on early July). > > May I commit them? > > I also attached two documents that describe how to use these extensions. I > guess this should go to the wiki just like for DW_AT_GNAT_descriptive_type > (https://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type). I will do this if > the patches are integrated. > > Thank you in advance! > > include/ > * dwarf2.def (DW_TAG_GNU_rational_constant): New tag. > (DW_AT_GNU_numerator, DW_AT_GNU_denominator): New attributes.
I don't think you really need a new TAG here -- DW_TAG_constant could just as easily take DW_AT_GNU_numerator and DW_AT_GNU_denominator as an alternative to DW_AT_const_value. I'm not really sure why DW_AT_small was defined to refer to a DW_TAG_constant DIE rather than just providing the constant as the attribute value. It would seem more efficient, space-wise, to have a DW_AT_scale attribute that would provide a multiplicative scale factor, and an optional DW_AT_scale_divisor to provide the denominator if necessary. Another, perhaps far-fetched, alternative would be to introduce a new form that would represent a rational constant as two unsigned LEB128 values, and allow that form for DW_AT_const_value and/or for DW_AT_small. For now, I'd suggest going with your proposal, except use the existing DW_TAG_constant instead of a new TAG. (I.e., just add the two new DW_AT_numerator and DW_AT_denominator attributes.) > include/ > * dwarf2.def (DW_AT_GNU_bias): New attribute. This is OK. Looks like a good idea to me. -cary