Files
third_party_elfutils/tests
Mark Wielaard 1e3c7b55cf readelf: Handle signedness of DW_FORM_implicit_const and DW_AT_const_value.
We only handles DW_FORM_sdata as a signed form, but DW_FORM_implicit_const
is also signed by default. For DW_AT_const_value we can do a little better.
GCC encodes some const_values with signed forms, even though the type
is unsigned. Lookup the (base) type of the DIE and display the const value
as their (signed) type/size (if we can determine that).

Add a new testcase run-readelf-const-values.sh that shows that.
With the new testcase the const values would come out as follows:

  name                 (string) "i"
  const_value          (implicit_const) 18446744073709551615
  name                 (string) "j"
  const_value          (implicit_const) 18446744073709551615

  name                 (string) "sc"
  const_value          (sdata) -2
  name                 (string) "uc"
  const_value          (sdata) -2
  name                 (string) "ss"
  const_value          (sdata) -16
  name                 (string) "us"
  const_value          (sdata) -16
  name                 (string) "si"
  const_value          (sdata) -3
  name                 (string) "ui"
  const_value          (sdata) -94967296
  name                 (string) "sl"
  const_value          (sdata) -1
  name                 (string) "ul"
  const_value          (sdata) -1

With this patch they show up as:

  name                 (string) "i"
  const_value          (implicit_const) -1
  name                 (string) "j"
  const_value          (implicit_const) -1

  name                 (string) "sc"
  const_value          (sdata) -2
  name                 (string) "uc"
  const_value          (sdata) 254 (-2)
  name                 (string) "ss"
  const_value          (sdata) -16
  name                 (string) "us"
  const_value          (sdata) 65520 (-16)
  name                 (string) "si"
  const_value          (sdata) -3
  name                 (string) "ui"
  const_value          (sdata) 4200000000 (-94967296)
  name                 (string) "sl"
  const_value          (sdata) -1
  name                 (string) "ul"
  const_value          (sdata) 18446744073709551615 (-1)

(for signed/unsigned int char, short and long)

Signed-off-by: Mark Wielaard <mark@klomp.org>
2018-06-15 23:48:26 +02:00
..
2018-02-10 03:19:26 +01:00
2014-04-18 11:46:51 +02:00
2015-06-27 14:56:12 +02:00
2018-02-10 03:19:26 +01:00
2013-11-26 03:10:31 +01:00
2017-07-26 23:22:38 +02:00
2016-07-11 10:22:18 +02:00
2018-04-23 18:46:53 +02:00
2016-01-06 14:27:10 +01:00
2016-06-28 20:09:11 +02:00
2013-11-26 03:10:31 +01:00
2016-07-11 10:22:18 +02:00
2018-04-23 18:46:53 +02:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-08-13 22:58:36 +00:00
2008-04-11 07:01:58 +00:00
2016-07-11 10:22:18 +02:00
2007-05-18 08:59:43 +00:00
2015-03-31 19:01:40 +02:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2008-04-11 07:01:58 +00:00
2008-04-11 07:01:58 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-07-26 05:00:05 +00:00
2005-08-18 22:01:57 +00:00
2005-08-27 10:33:26 +00:00
2005-08-27 10:33:26 +00:00
2006-04-05 01:35:26 +00:00
2006-04-05 01:35:26 +00:00
2006-08-03 08:52:46 +00:00
2006-08-03 08:52:46 +00:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-05-18 08:59:43 +00:00
2007-08-13 22:58:36 +00:00
2007-08-13 22:58:36 +00:00
2007-08-13 22:58:36 +00:00
2008-04-11 07:01:58 +00:00
2008-04-11 07:01:58 +00:00
2008-04-11 07:01:58 +00:00
2009-05-07 20:58:19 +02:00
2012-10-10 08:04:01 +02:00
2012-10-10 08:08:44 +02:00
2013-01-30 20:34:17 +01:00
2013-01-30 20:34:17 +01:00
2012-10-17 22:17:14 +02:00
2012-10-17 22:17:14 +02:00
2012-11-29 12:50:26 +01:00
2012-11-29 12:50:26 +01:00
2016-06-28 20:09:11 +02:00
2016-07-11 10:22:18 +02:00
2016-07-11 10:22:18 +02:00
2016-07-11 10:22:18 +02:00
2005-07-26 05:00:05 +00:00