diff mbox

Add extensions to dwarf2.def

Message ID 5576BB25.50203@adacore.com
State New
Headers show

Commit Message

Pierre-Marie de Rodat June 9, 2015, 10:08 a.m. UTC
Hello,

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.

include/
         * dwarf2.def (DW_AT_GNU_bias): New attribute.

Comments

Cary Coutant Aug. 13, 2015, 7:01 p.m. UTC | #1
> 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
diff mbox

Patch

From bb4667b65090d5c61710abb3f328a591cfa60ee9 Mon Sep 17 00:00:00 2001
From: Pierre-Marie de Rodat <derodat@adacore.com>
Date: Tue, 9 Jun 2015 10:31:50 +0200
Subject: [PATCH 2/2] DWARF2: add extensions to handle biased types

include/
	* dwarf2.def (DW_AT_GNU_bias): New attribute.
---
 include/dwarf2.def | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/dwarf2.def b/include/dwarf2.def
index 0634d6e..212ea54 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -413,6 +413,9 @@  DW_AT (DW_AT_GNAT_descriptive_type, 0x2302)
    See https://gcc.gnu.org/wiki/DW_TAG_GNU_rational_constant .  */
 DW_TAG (DW_AT_GNU_numerator, 0x2303)
 DW_TAG (DW_AT_GNU_denominator, 0x2304)
+/* Biased integer extension.
+   See https://gcc.gnu.org/wiki/DW_AT_GNU_bias .  */
+DW_TAG (DW_AT_GNU_bias, 0x2305)
 /* UPC extension.  */
 DW_AT (DW_AT_upc_threads_scaled, 0x3210)
 /* PGI (STMicroelectronics) extensions.  */
-- 
2.3.6