public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2090] dwarf2ctf: the unit of sou field location is bits [PR101283]
@ 2021-07-06 21:08 Indu Bhagat
0 siblings, 0 replies; only message in thread
From: Indu Bhagat @ 2021-07-06 21:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:151b423a82f4bf15e3225833028f5258ea254cb9
commit r12-2090-g151b423a82f4bf15e3225833028f5258ea254cb9
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date: Tue Jul 6 13:53:58 2021 -0700
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.
Diff:
---
gcc/dwarf2ctf.c | 4 ++--
gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gcc/dwarf2ctf.c b/gcc/dwarf2ctf.c
index 08e12520daa..5e8a7258583 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)
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c
index 9e698fde89e..37094b5d420 100644
--- a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c
@@ -10,6 +10,6 @@
/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*cta_nelems" 1 } } */
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctm_offset" 1 } } */
-/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctm_offset" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x20\[\t \]+\[^\n\]*ctm_offset" 1 } } */
static struct ranges {int from, to;} lim_regs[] = {{ 16, 7}, { 16, 6}, { 20, 7},{ 20, 6}};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-06 21:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 21:08 [gcc r12-2090] dwarf2ctf: the unit of sou field location is bits [PR101283] Indu Bhagat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).