* [PATCH] Fixed issues with processing of DW_FORM_loclistx / DW_FORM_rnglistx
@ 2021-01-21 5:49 Sharma, Alok Kumar via Gdb-patches
2021-01-21 5:53 ` Simon Marchi via Gdb-patches
0 siblings, 1 reply; 2+ messages in thread
From: Sharma, Alok Kumar via Gdb-patches @ 2021-01-21 5:49 UTC (permalink / raw)
To: gdb-patches; +Cc: George, Jini Susan, Achra, Nitika
[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]
Hi all,
I request you all to please review the patch. Below are the details.
Problem Description:
GDB produces internal error while processing DW_FORM_loclistx / DW_FORM_rnglistx,
$ make check RUNTESTFLAGS="CXX_FOR_TARGET=/path/to/clang++ " TEST=gdb.dwarf2/dw5-rnglist-test.exp
Below is the snippet from gdb.log file.
---------
(gdb) file /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test
Reading symbols from /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test...
gdb/dwarf2/attribute.h:232: internal-error: void attribute::set_unsigned_reprocess(ULONGEST): Assertion `form_requires_reprocessing ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) ERROR: Couldn't load dw5-rnglist-test into GDB (GDB internal error).
Resyncing due to internal error.
---------
This is due to incomplete handling of DW_FORM_loclistx / DW_FORM_rnglistx,
which is available with -gdwarf-5 option for clang compiler.
Resolution:
Forms DW_FORM_loclistx / DW_FORM_rnglistx need two phases of processing.
The required modifications in various routines are added to fix the issue.
gdb/ChangeLog:
2021-01-21 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
* dwarf2/attribute.c (form_is_unsigned): Handle DW_FORM_loclistx.
(form_requires_reprocessing): Handle DW_FORM_loclistx and
DW_FORM_rnglistx.
* dwarf2/attribute.h (set_address): Handle DW_FORM_loclistx and
DW_FORM_rnglistx.
* dwarf2/read.c (read_attribute_reprocess): Replaced as_unsigned with
as_unsigned_reprocess for DW_FORM_loclistx and DW_FORM_rnglistx.
Regards,
Alok
[-- Attachment #2: 0001-DWARF5-Fixed-issues-with-processing-of-DW_FORM_locli.patch --]
[-- Type: application/octet-stream, Size: 4754 bytes --]
From b42bf3de1e6bbc4f1598dd85a5545060a35aeb02 Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Wed, 20 Jan 2021 10:56:16 +0530
Subject: [PATCH] [DWARF5] Fixed issues with processing of DW_FORM_loclistx /
DW_FORM_rnglistx
GDB produces internal error while processing DW_FORM_loclistx / DW_FORM_rnglistx,
$ make check RUNTESTFLAGS="CXX_FOR_TARGET=/path/to/clang++ " TEST=gdb.dwarf2/dw5-rnglist-test.exp
Below is the snippet from gdb.log file.
---------
(gdb) file /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test
Reading symbols from /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test...
gdb/dwarf2/attribute.h:232: internal-error: void attribute::set_unsigned_reprocess(ULONGEST): Assertion `form_requires_reprocessing ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) ERROR: Couldn't load dw5-rnglist-test into GDB (GDB internal error).
Resyncing due to internal error.
---------
This is due to incomplete handling of DW_FORM_loclistx / DW_FORM_rnglistx,
which is available with -gdwarf-5 option for clang compiler.
Forms DW_FORM_loclistx / DW_FORM_rnglistx need two phases of processing.
The required modifications in various routines are added to fix the issue.
gdb/ChangeLog:
2021-01-21 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
* dwarf2/attribute.c (form_is_unsigned): Handle DW_FORM_loclistx.
(form_requires_reprocessing): Handle DW_FORM_loclistx and
DW_FORM_rnglistx.
* dwarf2/attribute.h (set_address): Handle DW_FORM_loclistx and
DW_FORM_rnglistx.
* dwarf2/read.c (read_attribute_reprocess): Replaced as_unsigned with
as_unsigned_reprocess for DW_FORM_loclistx and DW_FORM_rnglistx.
Change-Id: If8f54fc947dd686126563666b1463f8778618120
---
gdb/ChangeLog | 10 ++++++++++
gdb/dwarf2/attribute.c | 5 ++++-
gdb/dwarf2/attribute.h | 4 +++-
gdb/dwarf2/read.c | 7 +++++--
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d0e96331e5a..892248c831f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2021-01-21 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
+
+ * dwarf2/attribute.c (form_is_unsigned): Handle DW_FORM_loclistx.
+ (form_requires_reprocessing): Handle DW_FORM_loclistx and
+ DW_FORM_rnglistx.
+ * dwarf2/attribute.h (set_address): Handle DW_FORM_loclistx and
+ DW_FORM_rnglistx.
+ * dwarf2/read.c (read_attribute_reprocess): Replaced as_unsigned with
+ as_unsigned_reprocess for DW_FORM_loclistx and DW_FORM_rnglistx.
+
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
* gdb_bfd.c (debug_bfd_cache): Change type to bool.
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c
index 479261030c5..7caab5e3952 100644
--- a/gdb/dwarf2/attribute.c
+++ b/gdb/dwarf2/attribute.c
@@ -178,6 +178,7 @@ attribute::form_is_unsigned () const
|| form == DW_FORM_flag
|| form == DW_FORM_flag_present
|| form == DW_FORM_udata
+ || form == DW_FORM_loclistx
|| form == DW_FORM_rnglistx
|| form == DW_FORM_ref1
|| form == DW_FORM_ref2
@@ -197,7 +198,9 @@ attribute::form_requires_reprocessing () const
|| form == DW_FORM_strx4
|| form == DW_FORM_GNU_str_index
|| form == DW_FORM_addrx
- || form == DW_FORM_GNU_addr_index);
+ || form == DW_FORM_GNU_addr_index
+ || form == DW_FORM_loclistx
+ || form == DW_FORM_rnglistx);
}
/* See attribute.h. */
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index a3ff9b0eb9c..b2cfa297369 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -239,7 +239,9 @@ struct attribute
{
gdb_assert (form == DW_FORM_addr
|| ((form == DW_FORM_addrx
- || form == DW_FORM_GNU_addr_index)
+ || form == DW_FORM_GNU_addr_index
+ || form == DW_FORM_loclistx
+ || form == DW_FORM_rnglistx)
&& requires_reprocessing));
u.addr = addr;
requires_reprocessing = 0;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 309ff8331e7..2e29d70a5cd 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -20289,10 +20289,13 @@ read_attribute_reprocess (const struct die_reader_specs *reader,
attr->as_unsigned_reprocess ()));
break;
case DW_FORM_loclistx:
- attr->set_address (read_loclist_index (cu, attr->as_unsigned ()));
+ attr->set_address (read_loclist_index (cu,
+ attr->as_unsigned_reprocess ()));
break;
case DW_FORM_rnglistx:
- attr->set_address (read_rnglist_index (cu, attr->as_unsigned (), tag));
+ attr->set_address (read_rnglist_index (cu,
+ attr->as_unsigned_reprocess (),
+ tag));
break;
case DW_FORM_strx:
case DW_FORM_strx1:
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Fixed issues with processing of DW_FORM_loclistx / DW_FORM_rnglistx
2021-01-21 5:49 [PATCH] Fixed issues with processing of DW_FORM_loclistx / DW_FORM_rnglistx Sharma, Alok Kumar via Gdb-patches
@ 2021-01-21 5:53 ` Simon Marchi via Gdb-patches
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi via Gdb-patches @ 2021-01-21 5:53 UTC (permalink / raw)
To: Sharma, Alok Kumar, gdb-patches; +Cc: George, Jini Susan, Achra, Nitika
On 2021-01-21 12:49 a.m., Sharma, Alok Kumar via Gdb-patches wrote:
> Hi all,
>
> I request you all to please review the patch. Below are the details.
>
> Problem Description:
> GDB produces internal error while processing DW_FORM_loclistx / DW_FORM_rnglistx,
> $ make check RUNTESTFLAGS="CXX_FOR_TARGET=/path/to/clang++ " TEST=gdb.dwarf2/dw5-rnglist-test.exp
> Below is the snippet from gdb.log file.
> ---------
> (gdb) file /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test
> Reading symbols from /dir/gdb/testsuite/outputs/gdb.dwarf2/dw5-rnglist-test/dw5-rnglist-test...
> gdb/dwarf2/attribute.h:232: internal-error: void attribute::set_unsigned_reprocess(ULONGEST): Assertion `form_requires_reprocessing ()' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n) ERROR: Couldn't load dw5-rnglist-test into GDB (GDB internal error).
> Resyncing due to internal error.
> ---------
> This is due to incomplete handling of DW_FORM_loclistx / DW_FORM_rnglistx,
> which is available with -gdwarf-5 option for clang compiler.
> Resolution:
> Forms DW_FORM_loclistx / DW_FORM_rnglistx need two phases of processing.
> The required modifications in various routines are added to fix the issue.
>
> gdb/ChangeLog:
>
> 2021-01-21 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
>
> * dwarf2/attribute.c (form_is_unsigned): Handle DW_FORM_loclistx.
> (form_requires_reprocessing): Handle DW_FORM_loclistx and
> DW_FORM_rnglistx.
> * dwarf2/attribute.h (set_address): Handle DW_FORM_loclistx and
> DW_FORM_rnglistx.
> * dwarf2/read.c (read_attribute_reprocess): Replaced as_unsigned with
> as_unsigned_reprocess for DW_FORM_loclistx and DW_FORM_rnglistx.
>
> Regards,
> Alok
>
Hi Alok,
Could you please take a look at this series I posted yesterday?
https://sourceware.org/pipermail/gdb-patches/2021-January/175221.html
I think it contains pretty much the same changes (and more).
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-21 5:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 5:49 [PATCH] Fixed issues with processing of DW_FORM_loclistx / DW_FORM_rnglistx Sharma, Alok Kumar via Gdb-patches
2021-01-21 5:53 ` Simon Marchi via Gdb-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox