diff options
| author | Mark Wielaard <[email protected]> | 2018-06-13 14:03:24 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-06-15 23:48:26 +0200 |
| commit | 1e3c7b55cfc91ed80b743daad7517ad3e51b99e1 (patch) | |
| tree | 08ec91de1667c60731b8a3b2b61f16ad77a31a9f /tests/run-readelf-zdebug-rel.sh | |
| parent | 7a1fd63a74e456f0ad9ab954bc381050e702eeb6 (diff) | |
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 <[email protected]>
Diffstat (limited to 'tests/run-readelf-zdebug-rel.sh')
| -rwxr-xr-x | tests/run-readelf-zdebug-rel.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/run-readelf-zdebug-rel.sh b/tests/run-readelf-zdebug-rel.sh index ccccd82d..3f20078c 100755 --- a/tests/run-readelf-zdebug-rel.sh +++ b/tests/run-readelf-zdebug-rel.sh @@ -90,7 +90,7 @@ DWARF section [ 4] '.debug_info' at offset 0x58: decl_file (data1) testfile-zdebug-rel.c (1) decl_line (data1) 6 type (ref4) [ 9a] - const_value (sdata) -9 + const_value (sdata) 18446744073709551607 (-9) [ 74] variable abbrev: 6 name (string) "b" decl_file (data1) testfile-zdebug-rel.c (1) |
