aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2ctf.c
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2021-07-06 13:53:58 -0700
committerIndu Bhagat <indu.bhagat@oracle.com>2021-07-06 14:07:39 -0700
commit151b423a82f4bf15e3225833028f5258ea254cb9 (patch)
tree686a85ce5e8e4980a14312076ac1b1e1a4cf7ef2 /gcc/dwarf2ctf.c
parent4f6e181181a48c341e524653cae0885fd170131e (diff)
downloadgcc-151b423a82f4bf15e3225833028f5258ea254cb9.zip
gcc-151b423a82f4bf15e3225833028f5258ea254cb9.tar.gz
gcc-151b423a82f4bf15e3225833028f5258ea254cb9.tar.bz2
dwarf2ctf: the unit of sou field location is bits [PR101283]
If the value of the DW_AT_data_member_location attribute is constant, the associated unit is bytes. This patch amends incorrect behaviour which was being exercised with -gdwarf-2. This caused some of the failures as noted in PR debug/101283 (specifically the BTF tests involving btm_offset). The testcase ctf-struct-array-2.c was erroneously checking for the value of ctm_offset in number of bytes. The patch fixes the calculation of the field location value for a struct member in dwarf2ctf and adjusts the testcase. This patch also fixes some of the failing tests as noted in PR debug/101283. 2021-07-06 Indu Bhagat <indu.bhagat@oracle.com> gcc/ChangeLog: PR debug/101283 * dwarf2ctf.c (ctf_get_AT_data_member_location): Multiply by 8 to get number of bits. gcc/testsuite/ChangeLog: PR debug/101283 * gcc.dg/debug/ctf/ctf-struct-array-2.c: Adjust the value in the testcase.
Diffstat (limited to 'gcc/dwarf2ctf.c')
-rw-r--r--gcc/dwarf2ctf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/dwarf2ctf.c b/gcc/dwarf2ctf.c
index 08e1252..5e8a725 100644
--- a/gcc/dwarf2ctf.c
+++ b/gcc/dwarf2ctf.c
@@ -100,13 +100,13 @@ ctf_get_AT_data_member_location (dw_die_ref die)
gcc_assert (!descr->dw_loc_oprnd2.v.val_unsigned);
gcc_assert (descr->dw_loc_oprnd2.val_class
== dw_val_class_unsigned_const);
- field_location = descr->dw_loc_oprnd1.v.val_unsigned;
+ field_location = descr->dw_loc_oprnd1.v.val_unsigned * 8;
}
else
{
attr = get_AT (die, DW_AT_data_member_location);
if (attr && AT_class (attr) == dw_val_class_const)
- field_location = AT_int (attr);
+ field_location = AT_int (attr) * 8;
else
field_location = (get_AT_unsigned (die,
DW_AT_data_member_location)