Cary,
Thank you for your answer!
On 08/13/2015 09:01 PM, Cary Coutant wrote:
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.
Good idea! I updated the patch accordingly.
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.
Agreed.
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.
Indeed, that's an option, but I find it not very convenient: a new form
would require us to enhance all DWARF reading tools whereas adding new
tags and attributes is very smooth (not sure this is a good reason, but
anyway...).
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.)
That's what I did.
include/
* dwarf2.def (DW_AT_GNU_bias): New attribute.
This is OK. Looks like a good idea to me.
Great. Thank you again! I comitted the two attached (and updated)
patches. I will update the corresponding dwarf2out.c changes I submitted
on July as well.
I also tried to create the new pages on the wiki but it says "You are
not allowed to edit this page."
(<https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator?action=edit>,
I'm logged in as pmderodat). Does anyone know how I should proceed?
--
Pierre-Marie de Rodat
>From 5b18866caaa8206788baf086c02a7aaf91d555a6 Mon Sep 17 00:00:00 2001
From: Pierre-Marie de Rodat <dero...@adacore.com>
Date: Tue, 9 Jun 2015 10:31:50 +0200
Subject: [PATCH 1/2] DWARF2: add extensions to handle fixed point types
include/ChangeLog:
* dwarf2.def (DW_AT_GNU_numerator, DW_AT_GNU_denominator): New
attributes.
---
include/ChangeLog | 5 +++++
include/dwarf2.def | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/include/ChangeLog b/include/ChangeLog
index 46a4a28..ee59133 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-14 Pierre-Marie de Rodat <dero...@adacore.com>
+
+ * dwarf2.def (DW_AT_GNU_numerator, DW_AT_GNU_denominator): New
+ attributes.
+
2015-08-11 Trevor Saunders <tbsaunde+...@tbsaunde.org>
* ansidecl.h (GCC_FINAL): New macro.
diff --git a/include/dwarf2.def b/include/dwarf2.def
index e61cfbe..9603c04 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -404,6 +404,10 @@ DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . */
DW_AT (DW_AT_use_GNAT_descriptive_type, 0x2301)
DW_AT (DW_AT_GNAT_descriptive_type, 0x2302)
+/* Rational constant extension.
+ See https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator . */
+DW_TAG (DW_AT_GNU_numerator, 0x2303)
+DW_TAG (DW_AT_GNU_denominator, 0x2304)
/* UPC extension. */
DW_AT (DW_AT_upc_threads_scaled, 0x3210)
/* PGI (STMicroelectronics) extensions. */
--
2.4.6
>From fcddb9fe71187eca4f49576c4f36e5a3d051b669 Mon Sep 17 00:00:00 2001
From: Pierre-Marie de Rodat <dero...@adacore.com>
Date: Tue, 9 Jun 2015 10:31:50 +0200
Subject: [PATCH 2/2] DWARF2: add extensions to handle biased types
include/ChangeLog:
* dwarf2.def (DW_AT_GNU_bias): New attribute.
---
include/ChangeLog | 4 ++++
include/dwarf2.def | 3 +++
2 files changed, 7 insertions(+)
diff --git a/include/ChangeLog b/include/ChangeLog
index ee59133..6962f85 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,9 @@
2015-08-14 Pierre-Marie de Rodat <dero...@adacore.com>
+ * dwarf2.def (DW_AT_GNU_bias): New attribute.
+
+2015-08-14 Pierre-Marie de Rodat <dero...@adacore.com>
+
* dwarf2.def (DW_AT_GNU_numerator, DW_AT_GNU_denominator): New
attributes.
diff --git a/include/dwarf2.def b/include/dwarf2.def
index 9603c04..2dfee56 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -408,6 +408,9 @@ DW_AT (DW_AT_GNAT_descriptive_type, 0x2302)
See https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator . */
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.4.6