[Bug tools/24550] eu-readelf does not know about DW_AT_GNU_{bias,numerator,denumerator}

2019-05-14 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24550

Mark Wielaard  changed:

   What|Removed |Added

 CC||mark at klomp dot org
Summary|eu-readelf does not know|eu-readelf does not know
   |about DW_AT_GNU_bias|about
   ||DW_AT_GNU_{bias,numerator,d
   ||enumerator}

--- Comment #1 from Mark Wielaard  ---
We are also missing GNU_AT_GNU_numerator and GNU_AT_GNU_denominator.

In theory all that is needed is add them to dwarf.h.
Since they are simple constant attributes.

diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index dc5973352..71ca2baae 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -351,6 +351,12 @@ enum
 DW_AT_GNU_pubnames = 0x2134,
 DW_AT_GNU_pubtypes = 0x2135,

+/* https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator  */
+DW_AT_GNU_numerator = 0x2303,
+DW_AT_GNU_denominator = 0x2304,
+/* https://gcc.gnu.org/wiki/DW_AT_GNU_bias  */
+DW_AT_GNU_bias = 0x2305,
+
 DW_AT_hi_user = 0x3fff
   };

But I want to make sure we get the type/signedness right.

Could you help me with creating gnat examples that compile and show their
usage?

If I try to compile your example I get two warnings:

tt.adb:4:04: warning: size clause forces biased representation for "Small"
tt.adb:8:03: warning: size clause forces biased representation for
"Repeat_Count_T"

Are those expected?

Also the subranges come out as:

 [4e]  subrange_typeabbrev: 3
   lower_bound  (sdata) -7
   upper_bound  (sdata) -4
   GNU_bias (sdata) -7
   name (strp) "tt__small"
   type (ref4) [8d]
 [8d]base_typeabbrev: 7
 byte_size(data1) 1
 encoding (data1) signed (5)
 name (strp) "tt__TsmallB"
 artificial   (flag_present) yes

and

 [6d]  subrange_typeabbrev: 6
   upper_bound  (sdata) 64
   GNU_bias (sdata) 1
   name (strp) "tt__repeat_count_t"
   type (ref4) [94]
 [94]base_typeabbrev: 7
 byte_size(data1) 1
 encoding (data1) signed (5)
 name (strp) "tt__Trepeat_count_tB"
 artificial   (flag_present) yes

There are three things that surprised me about this.
First that the byte_size is 1, are these types really using a full byte and not
2 or 6 bits?
And second that the bias is on the subrange_type and not the base_type. Is that
intended?
Finally, why is the last type signed?

Also could you help me create an compilable example of
https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator

Thanks,

Mark

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [PATCH] readelf: Clean up section lists after usage.

2019-05-14 Thread Mark Wielaard
On Thu, May 09, 2019 at 04:55:23PM +0200, Mark Wielaard wrote:
> +2019-05-09  Mark Wielaard  
> +
> + * readelf.c (cleanup_list): New function.
> + (main): Call cleanup_list for dump_data_sections and string_sections.

Pushed to master.


Re: [PATCH] readelf: Decode DW_AT_discr_list block attributes.

2019-05-14 Thread Mark Wielaard
On Fri, May 10, 2019 at 11:48:32AM -0600, Tom Tromey wrote:
> > "Mark" == Mark Wielaard  writes:
> 
> Mark> Decode DW_AT_descr_list blocks using the DW_DSC values.
> Mark> This requires knowing the signedness of the discriminant.
> Mark> Which means the attr_callback function needs access to the
> Mark> parent DIE. Pass the whole DIE path, plus the current level.
> Mark> That way the type of the discriminant can be looked up in
> Mark> the variant_part (parent) DIE of the variant DIE (which has
> Mark> the discr_list attribute).
> 
> Mark> Add a testcase using both signed and unsigned discriminants.
> 
> Mark> https://sourceware.org/bugzilla/show_bug.cgi?id=24509
> 
> Thank you for doing this.

I took this as "patch looks perfect" and pushed it to master.

Cheers,

Mark