Re: [PATCH] Add extensions to dwarf2.def
On 08/18/2015 11:36 AM, Manuel López-Ibáñez wrote: On 18/08/15 10:32, Pedro Alves wrote: On 08/14/2015 10:49 AM, Pierre-Marie de Rodat wrote: 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? I believe you need to be added to the editor group: https://gcc.gnu.org/wiki/EditorGroup You need someone on that list to add you. (I'm not on the list). Added. Please try now. I successfuly created the two wiki pages, thanks to both of you! As a side note, for some reason I could no longer login and I had to re-create my account (same identifier, which worked). I'm not sure, but I think it's the second time I had to do that (the first time I thought I did something wrong...). -- Pierre-Marie de Rodat
Re: [PATCH] Add extensions to dwarf2.def
On 08/14/2015 10:49 AM, Pierre-Marie de Rodat wrote: 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? I believe you need to be added to the editor group: https://gcc.gnu.org/wiki/EditorGroup You need someone on that list to add you. (I'm not on the list). Thanks, Pedro Alves
Re: [PATCH] Add extensions to dwarf2.def
On 18 August 2015 at 14:38, Pierre-Marie de Rodat dero...@adacore.com wrote: I think it would be great to copy this text in GCC's: may I do this? Sorry, I did it before I read your message. For the future, I would advise to Just Do It and then say that you did it. It is a wiki, it can always be reverted if someone disagrees. Perhaps it would be great if the GNU tools did not have some much duplicated infrastructure (and inconsistent red-tape), but oh well... Cheers, Manuel.
Re: [PATCH] Add extensions to dwarf2.def
On 08/18/2015 02:47 PM, Manuel López-Ibáñez wrote: Sorry, I did it before I read your message. For the future, I would advise to Just Do It and then say that you did it. It is a wiki, it can always be reverted if someone disagrees. Sure, I have no problem with the paternity of this change. ;-) Thank you! I will just do it next time. -- Pierre-Marie de Rodat
Re: [PATCH] Add extensions to dwarf2.def
On 08/18/2015 02:15 PM, Pedro Alves wrote: The blurb at the top of glibc's page explains this: https://sourceware.org/glibc/wiki/EditorGroup [...] Looks like neither GCC's nor GDB's borrowed that longer text yet. Ok, understood. Thank you very much! I think it would be great to copy this text in GCC's: may I do this? -- Pierre-Marie de Rodat
Re: [PATCH] Add extensions to dwarf2.def
On 08/18/2015 11:24 AM, Pierre-Marie de Rodat wrote: I successfuly created the two wiki pages, thanks to both of you! As a side note, for some reason I could no longer login and I had to re-create my account (same identifier, which worked). I'm not sure, but I think it's the second time I had to do that (the first time I thought I did something wrong...). The blurb at the top of glibc's page explains this: https://sourceware.org/glibc/wiki/EditorGroup As part of this wiki's spam prevention process we keep a community maintained list of allowed editors. Members of this group are allowed to edit the wiki. This is a community maintained list. As a member of EditorGroup you can add other users to this list but by doing so you vouch for them. This process has reduced spam to zero since only those interested humans are willing to ask to be added by other humans who vouch for them. Despite this feature, and our desire to keep the registration process open, the spammers still fill the database with new login entries that slow down MoinMoin. To combat spam login accounts we routinely purge the account database down to the list of users that are on this page. If you find your account was purged, please create it again, and make sure to get yourself added to this list. Looks like neither GCC's nor GDB's borrowed that longer text yet. Thanks, Pedro Alves
Re: [PATCH] Add extensions to dwarf2.def
On 18/08/15 10:32, Pedro Alves wrote: On 08/14/2015 10:49 AM, Pierre-Marie de Rodat wrote: 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? I believe you need to be added to the editor group: https://gcc.gnu.org/wiki/EditorGroup You need someone on that list to add you. (I'm not on the list). Added. Please try now. Cheers, Manuel.
Re: [PATCH] Add extensions to dwarf2.def
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
Re: [PATCH] Add extensions to dwarf2.def
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
[PATCH] Add extensions to dwarf2.def
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. -- Pierre-Marie de Rodat == Introduction == Ada makes it possible to define fixed point types. In order to specify how these will be represented at runtime, the compiler selects a size in bytes and a scale factor, which is a strictly positive rational number. Assuming type T is associated with the S scale factor, then values V will be represented at runtime by R so that V = S * R. == Fixed points in DWARF today == Since DWARFv3, there are several ways to describe fixed point types, all of these require to use DW_TAG_base_type DIEs. The encoding must be DW_ATE_signed_fixed or DW_ATE_unsigned_fixed and the scale factor must be encoded using one of the following attributes: * DW_AT_decimal_scale, which makes it possible to represent scale factors of the form 10**N (with N any signed integer). * DW_AT_binary_scale, which makes it possible to represent scale factors of the form 2**N (with N any signed integer). * DW_AT_small, which is a reference to a DW_TAG_constant entry providing the scale factor itself. == Limitations == While DW_AT_small enables one to describe any scale factor the two other attributes could, there are still some scale factors that are not encodable as of today. In Ada, it is possible to define fixed point types with scale factors such as 1/3. For instance: type T is delta 0.1 range 0.0 .. 1.0 with Small = 1.0/3.0; Trying to represent 1/3 with a DW_TAG_constant leads to a chicken an egg problem today: the constant is encoded in the DW_AT_const_value attribute, which must be the actual constant value [...] represented as it would be on the target architecture. 1/3 can be represented on the target architecture, but only with a fixed point type... whose scalar factor is 1/3, or 1/30, etc. == Proposed extension == One new tag and two new attributes are proposed to solve this problem: * DW_TAG_GNU_rational_constant, whose purpose is to describe any rational constant. It must have exactly two attributes: * DW_AT_GNU_numerator and DW_AT_GNU_denominator, whose forms are any constant form (DW_FORM_*data*) and which represent an integer (unsigned, unless the form represents a signed one). The rational constant represented by DW_TAG_GNU_rational_constant is N/D where: * N is the integer represented by the DW_AT_GNU_numerator attribute; * D is the integer represented by the DW_AT_GNU_denominator attribute; With this new tag, it is possible to represent arbitrary rational scale factors for fixed point types, enabling one to describe all possible Ada fixed point types. == Introduction == In Ada, it is possible for a scalar type to have a biased representation in some contexts. For instance: type Small_Type is range 50 .. 57; type Record_Type is record A, B : Small_Type; end record; for Record_Type use record A at 0 range 0 .. 2; B at 0 range 3 .. 5; end record; In Record_Type, the A and B fields will be represented on 3 bits each. This is possible because they have a biased representation: * the 000 bit pattern represents 50; * the 001 one represents 51; * etc. So in this example, the representation for A and B have a bias of 50. The general principle is that given some type T, a bias B and a value V, the runtime representation for V is: V - B There is no way to describe this representation in DWARF today. == Proposed extension == One new attribute is proposed to lift this limitation: DW_AT_GNU_bias, whose form is any constant form and which represents an integer (unsigned, unless the form represents a signed