- Maintenance script qa.sh:
* Update PR28561 kfail. * Update PR29781 kfail. - Maintenance script qa-local.sh: * Add "Verify quilt setup" step. - Patches added (backport from master): * gdb-symtab-handle-self-reference-die.patch * gdb-symtab-handle-self-reference-in-inherit_abstract.patch * gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=368
This commit is contained in:
parent
6827fe2016
commit
8961c2b3e4
299
gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
Normal file
299
gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
Normal file
@ -0,0 +1,299 @@
|
||||
From 7f4601b0a51f400bd1b1bc0f7895254d467e3bb4 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 21 Jul 2023 08:25:25 +0200
|
||||
Subject: [PATCH] [gdb/symtab] Add optimized out static var to cooked index
|
||||
|
||||
Consider the test-case:
|
||||
...
|
||||
$ cat main.c
|
||||
int main (void) { return 0; }
|
||||
$ cat static-optimized-out.c
|
||||
static int aaa;
|
||||
...
|
||||
compiled like this:
|
||||
...
|
||||
$ gcc-12 static-optimized-out.c main.c -g -O2 -flto
|
||||
...
|
||||
|
||||
There's a difference in behaviour depending on symtab expansion state:
|
||||
...
|
||||
$ gdb -q -batch a.out -ex "print aaa"
|
||||
No symbol "aaa" in current context.
|
||||
$ gdb -q -batch a.out -ex "maint expand-symtab" -ex "print aaa"
|
||||
$1 = <optimized out>
|
||||
...
|
||||
|
||||
The reason for the difference is that the optimized out variable aaa:
|
||||
...
|
||||
<1><104>: Abbrev Number: 2 (DW_TAG_variable)
|
||||
<105> DW_AT_name : aaa
|
||||
<109> DW_AT_decl_file : 1
|
||||
<10a> DW_AT_decl_line : 18
|
||||
<10b> DW_AT_decl_column : 12
|
||||
<10c> DW_AT_type : <0x110>
|
||||
...
|
||||
is not added to the cooked index because of this clause in abbrev_table::read:
|
||||
...
|
||||
else if (!has_location && !has_specification_or_origin && !has_external
|
||||
&& cur_abbrev->tag == DW_TAG_variable)
|
||||
cur_abbrev->interesting = false;
|
||||
...
|
||||
|
||||
Fix this inconsistency by making sure that the optimized out variable is added
|
||||
to the cooked index.
|
||||
|
||||
Regression tested on x86_64-linux.
|
||||
|
||||
Add two test-cases, a C test-case gdb.opt/static-optimized-out.exp and a dwarf
|
||||
assembly test-case gdb.dwarf2/static-optimized-out.exp.
|
||||
|
||||
Tested gdb.opt/static-optimized-out.exp with gcc-8 to gcc-12, for which we now
|
||||
consistently get:
|
||||
...
|
||||
(gdb) print aaa^M
|
||||
$1 = <optimized out>^M
|
||||
...
|
||||
and with gcc 7.5.0 and clang 13.0.1, for which we still consistently get:
|
||||
...
|
||||
(gdb) print aaa^M
|
||||
No symbol "aaa" in current context.^M
|
||||
...
|
||||
due to missing debug info for the variable.
|
||||
|
||||
PR symtab/30656
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30656
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/dwarf2/abbrev.c | 9 ---
|
||||
.../gdb.dwarf2/static-optimized-out.exp | 69 +++++++++++++++++++
|
||||
gdb/testsuite/gdb.opt/main.c | 22 ++++++
|
||||
gdb/testsuite/gdb.opt/static-optimized-out.c | 18 +++++
|
||||
.../gdb.opt/static-optimized-out.exp | 49 +++++++++++++
|
||||
5 files changed, 158 insertions(+), 9 deletions(-)
|
||||
create mode 100644 gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
create mode 100644 gdb/testsuite/gdb.opt/main.c
|
||||
create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
|
||||
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
|
||||
index 1ebf8f6eed5..3a429fd41b1 100644
|
||||
--- a/gdb/dwarf2/abbrev.c
|
||||
+++ b/gdb/dwarf2/abbrev.c
|
||||
@@ -162,7 +162,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
bool has_specification_or_origin = false;
|
||||
bool has_name = false;
|
||||
bool has_linkage_name = false;
|
||||
- bool has_location = false;
|
||||
bool has_external = false;
|
||||
|
||||
/* Now read in declarations. */
|
||||
@@ -217,11 +216,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
has_linkage_name = true;
|
||||
break;
|
||||
|
||||
- case DW_AT_const_value:
|
||||
- case DW_AT_location:
|
||||
- has_location = true;
|
||||
- break;
|
||||
-
|
||||
case DW_AT_sibling:
|
||||
if (is_csize && cur_attr.form == DW_FORM_ref4)
|
||||
sibling_offset = size;
|
||||
@@ -296,9 +290,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
cur_abbrev->interesting = false;
|
||||
else if (!tag_interesting_for_index (cur_abbrev->tag))
|
||||
cur_abbrev->interesting = false;
|
||||
- else if (!has_location && !has_specification_or_origin && !has_external
|
||||
- && cur_abbrev->tag == DW_TAG_variable)
|
||||
- cur_abbrev->interesting = false;
|
||||
else
|
||||
cur_abbrev->interesting = true;
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
new file mode 100644
|
||||
index 00000000000..1547a8acbc0
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
@@ -0,0 +1,69 @@
|
||||
+# Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Check that an optimized out static variable is printed the same independent
|
||||
+# of state of symtab expansion. See also gdb.opt/static-optimized-out.exp.
|
||||
+
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if { ![dwarf2_support] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile main.c -dw.S
|
||||
+
|
||||
+# Make DWARF for the test.
|
||||
+set asm_file [standard_output_file $srcfile2]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ cu {} {
|
||||
+ compile_unit {
|
||||
+ {
|
||||
+ language @DW_LANG_C
|
||||
+ }
|
||||
+ } {
|
||||
+ declare_labels integer_label
|
||||
+
|
||||
+ integer_label: DW_TAG_base_type {
|
||||
+ {DW_AT_byte_size 4 DW_FORM_sdata}
|
||||
+ {DW_AT_encoding @DW_ATE_signed}
|
||||
+ {DW_AT_name integer}
|
||||
+ }
|
||||
+
|
||||
+ DW_TAG_variable {
|
||||
+ {name var}
|
||||
+ {type :$integer_label}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" ${testfile} \
|
||||
+ [list $srcfile $asm_file] {nodebug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "print var" " = <optimized out>"
|
||||
+
|
||||
+# Expand all symbol tables.
|
||||
+gdb_test_no_output "maint expand-symtabs"
|
||||
+
|
||||
+# Make sure we do an actual lookup rather than just returning the same as
|
||||
+# before.
|
||||
+gdb_test_no_output "maint flush symbol-cache"
|
||||
+
|
||||
+with_test_prefix "after expand-symtabs" {
|
||||
+ gdb_test "print var" " = <optimized out>"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.opt/main.c b/gdb/testsuite/gdb.opt/main.c
|
||||
new file mode 100644
|
||||
index 00000000000..c6beff77dbe
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/main.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.c b/gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
new file mode 100644
|
||||
index 00000000000..44287fbd6d2
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+static int aaa;
|
||||
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.exp b/gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
new file mode 100644
|
||||
index 00000000000..bd673b6503e
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Check that an optimized out static variable is printed the same independent
|
||||
+# of state of symtab expansion. See also gdb.dwarf2/static-optimized-out.exp.
|
||||
+
|
||||
+standard_testfile .c main.c
|
||||
+
|
||||
+set opts {}
|
||||
+lappend opts debug
|
||||
+lappend opts "optimize=-O2 -flto"
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile \
|
||||
+ [list $srcfile $srcfile2] $opts] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set val ""
|
||||
+gdb_test_multiple "print aaa" "" {
|
||||
+ -re -wrap "\r\n(?:\\$$decimal = )?(\[^\r\n\]*)" {
|
||||
+ set val $expect_out(1,string)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { $val == "" } {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Expand all symbol tables.
|
||||
+gdb_test_no_output "maint expand-symtab"
|
||||
+
|
||||
+# Make sure we do an actual lookup rather than just returning the same as
|
||||
+# before.
|
||||
+gdb_test_no_output "maint flush symbol-cache"
|
||||
+
|
||||
+# Now check that we get the same result in both cases.
|
||||
+gdb_test "print aaa" [string_to_regexp $val] "consistency"
|
||||
|
||||
base-commit: 800c393f89a94f49b01dff99f693cb13c5e28116
|
||||
--
|
||||
2.35.3
|
||||
|
159
gdb-symtab-handle-self-reference-die.patch
Normal file
159
gdb-symtab-handle-self-reference-die.patch
Normal file
@ -0,0 +1,159 @@
|
||||
From 8f53ac47d3f9c3800c8429d9187961ba81707d8b Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 16 Aug 2023 23:43:25 +0200
|
||||
Subject: [PATCH 1/2] [gdb/symtab] Handle self-reference DIE
|
||||
|
||||
While working on a dwarf assembly test-case I accidentally created the
|
||||
following pathological dwarf:
|
||||
...
|
||||
<1><be>: Abbrev Number: 3 (DW_TAG_class_type)
|
||||
<bf> DW_AT_name : c1
|
||||
<c2> DW_AT_specification: <0xbe>
|
||||
...
|
||||
and noticed gdb segfaulting during cooked index creating due to running out of
|
||||
stack. This is a regression from gdb-12, where gdb just hung.
|
||||
|
||||
Fix this by inhibiting the scan_attributes self-recursion for self-references.
|
||||
|
||||
The same test-case with -readnow makes gdb hang, so also fix this in
|
||||
dwarf2_attr and follow_die_ref.
|
||||
|
||||
Note that this doesn't fix the same problems for the more complicated case of:
|
||||
...
|
||||
<1><be>: Abbrev Number: 3 (DW_TAG_class_type)
|
||||
<bf> DW_AT_name : c1
|
||||
<c2> DW_AT_specification: <0xc6>
|
||||
<1><c6>: Abbrev Number: 4 (DW_TAG_class_type)
|
||||
<c7> DW_AT_name : c2
|
||||
<ca> DW_AT_specification: <0xbe>
|
||||
...
|
||||
but the approach for deciding whether to fix pathological dwarf cases is as
|
||||
per PR27981 comment 3:
|
||||
...
|
||||
yes if it is cheap/obvious, and no if it is something complicated or expensive.
|
||||
...
|
||||
and at this point I'm not sure whether fixing this will fall in the first
|
||||
category.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/dwarf2/read.c | 22 +++++++++--
|
||||
gdb/testsuite/gdb.dwarf2/self-spec.exp | 54 ++++++++++++++++++++++++++
|
||||
2 files changed, 73 insertions(+), 3 deletions(-)
|
||||
create mode 100644 gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 61f4bd75013..1be5f381432 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -18289,9 +18289,15 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
|
||||
new_info_ptr,
|
||||
&bytes_read);
|
||||
new_info_ptr += bytes_read;
|
||||
- scan_attributes (scanning_per_cu, new_reader, new_info_ptr, new_info_ptr,
|
||||
- new_abbrev, name, linkage_name, flags, nullptr,
|
||||
- parent_entry, maybe_defer, true);
|
||||
+
|
||||
+ if (new_reader->cu == reader->cu && new_info_ptr == watermark_ptr)
|
||||
+ {
|
||||
+ /* Self-reference, we're done. */
|
||||
+ }
|
||||
+ else
|
||||
+ scan_attributes (scanning_per_cu, new_reader, new_info_ptr,
|
||||
+ new_info_ptr, new_abbrev, name, linkage_name,
|
||||
+ flags, nullptr, parent_entry, maybe_defer, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19783,7 +19789,11 @@ dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
|
||||
if (!spec)
|
||||
break;
|
||||
|
||||
+ struct die_info *prev_die = die;
|
||||
die = follow_die_ref (die, spec, &cu);
|
||||
+ if (die == prev_die)
|
||||
+ /* Self-reference, we're done. */
|
||||
+ break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -22521,6 +22531,12 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr,
|
||||
struct dwarf2_cu *cu = *ref_cu;
|
||||
struct die_info *die;
|
||||
|
||||
+ if (attr->form != DW_FORM_GNU_ref_alt && src_die->sect_off == sect_off)
|
||||
+ {
|
||||
+ /* Self-reference, we're done. */
|
||||
+ return src_die;
|
||||
+ }
|
||||
+
|
||||
die = follow_die_offset (sect_off,
|
||||
(attr->form == DW_FORM_GNU_ref_alt
|
||||
|| cu->per_cu->is_dwz),
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
new file mode 100644
|
||||
index 00000000000..77e92549fd1
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Check that gdb doesn't hang or segfault on reading a DIE with a
|
||||
+# specification reference to itself.
|
||||
+
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile main.c .S
|
||||
+
|
||||
+# Create the DWARF.
|
||||
+set asm_file [standard_output_file $srcfile2]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ cu {} {
|
||||
+ compile_unit {{language @DW_LANG_C_plus_plus}} {
|
||||
+ declare_labels c1
|
||||
+ c1: class_type {
|
||||
+ {name c1}
|
||||
+ {specification :$c1}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set index [have_index $binfile]
|
||||
+if { ![string eq $index ""] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if { [readnow] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_test "maint expand-symtabs"
|
||||
|
||||
base-commit: 6c9e159dbd1a35aafa134fcd52982174236a8dd9
|
||||
--
|
||||
2.35.3
|
||||
|
92
gdb-symtab-handle-self-reference-in-inherit_abstract.patch
Normal file
92
gdb-symtab-handle-self-reference-in-inherit_abstract.patch
Normal file
@ -0,0 +1,92 @@
|
||||
From 800c393f89a94f49b01dff99f693cb13c5e28116 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Mon, 28 Aug 2023 16:27:58 +0200
|
||||
Subject: [PATCH 2/2] [gdb/symtab] Handle self-reference in
|
||||
inherit_abstract_dies
|
||||
|
||||
Building gdb with gcc 7.5.0 and -flto -O2 -flto-partition=one generates a
|
||||
self-referencing DIE:
|
||||
...
|
||||
<2><91dace>: Abbrev Number: 405 (DW_TAG_label)
|
||||
<91dad0> DW_AT_abstract_origin: <0x91dace>
|
||||
...
|
||||
|
||||
When encountering the self-reference DIE in inherit_abstract_dies we loop
|
||||
following the abstract origin, effectively hanging gdb.
|
||||
|
||||
Fix this by handling self-referencing DIEs in the loop in
|
||||
inherit_abstract_dies.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR symtab/30799
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=30799
|
||||
---
|
||||
gdb/dwarf2/read.c | 7 +++++++
|
||||
gdb/testsuite/gdb.dwarf2/self-spec.exp | 16 +++++++++++++++-
|
||||
2 files changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 1be5f381432..970dd54c7a5 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -11938,8 +11938,15 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
|
||||
if (attr == nullptr)
|
||||
break;
|
||||
|
||||
+ die_info *prev_child_origin_die = child_origin_die;
|
||||
child_origin_die = follow_die_ref (child_origin_die, attr,
|
||||
&child_origin_cu);
|
||||
+
|
||||
+ if (prev_child_origin_die == child_origin_die)
|
||||
+ {
|
||||
+ /* Handle DIE with self-reference. */
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* If missing DW_AT_abstract_origin, try the corresponding child
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
index 77e92549fd1..f04ff6da42e 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
|
||||
@@ -14,7 +14,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Check that gdb doesn't hang or segfault on reading a DIE with a
|
||||
-# specification reference to itself.
|
||||
+# specification/abstract_origin reference to itself.
|
||||
|
||||
load_lib dwarf.exp
|
||||
|
||||
@@ -29,11 +29,25 @@ set asm_file [standard_output_file $srcfile2]
|
||||
Dwarf::assemble $asm_file {
|
||||
cu {} {
|
||||
compile_unit {{language @DW_LANG_C_plus_plus}} {
|
||||
+ # Check handling of self-referencing DIE.
|
||||
declare_labels c1
|
||||
c1: class_type {
|
||||
{name c1}
|
||||
{specification :$c1}
|
||||
}
|
||||
+
|
||||
+ # Check handling of self-referencing child DIE. Regression test
|
||||
+ # for PR30799.
|
||||
+ declare_labels f1 abstract_f1 f1_l
|
||||
+ abstract_f1: subprogram {}
|
||||
+ f1: subprogram {
|
||||
+ {MACRO_AT_func {main}}
|
||||
+ {abstract_origin :$abstract_f1}
|
||||
+ } {
|
||||
+ f1_l: label {
|
||||
+ {abstract_origin :$f1_l}
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.35.3
|
||||
|
13
gdb.changes
13
gdb.changes
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Oct 29 18:57:21 UTC 2023 - Tom de Vries <tdevries@suse.com>
|
||||
|
||||
- Maintenance script qa.sh:
|
||||
* Update PR28561 kfail.
|
||||
* Update PR29781 kfail.
|
||||
- Maintenance script qa-local.sh:
|
||||
* Add "Verify quilt setup" step.
|
||||
- Patches added (backport from master):
|
||||
* gdb-symtab-handle-self-reference-die.patch
|
||||
* gdb-symtab-handle-self-reference-in-inherit_abstract.patch
|
||||
* gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 26 12:51:55 UTC 2023 - Tom de Vries <tdevries@suse.com>
|
||||
|
||||
|
6
gdb.spec
6
gdb.spec
@ -334,6 +334,9 @@ Patch2040: gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
|
||||
Patch2041: xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch
|
||||
Patch2042: avoid-manual-memory-management-in-go-lang.c.patch
|
||||
Patch2043: gdb-go-handle-v3-go_0-mangled-prefix.patch
|
||||
Patch2044: gdb-symtab-handle-self-reference-die.patch
|
||||
Patch2045: gdb-symtab-handle-self-reference-in-inherit_abstract.patch
|
||||
Patch2046: gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
|
||||
|
||||
# Backports from master, not yet available in next release.
|
||||
|
||||
@ -773,6 +776,9 @@ find -name "*.info*"|xargs rm -f
|
||||
%patch2041 -p1
|
||||
%patch2042 -p1
|
||||
%patch2043 -p1
|
||||
%patch2044 -p1
|
||||
%patch2045 -p1
|
||||
%patch2046 -p1
|
||||
|
||||
%patch2070 -p1
|
||||
|
||||
|
18
qa-local.sh
18
qa-local.sh
@ -28,9 +28,10 @@ usage ()
|
||||
echo "usage: $0 <1-4>"
|
||||
echo "1: Cleanup"
|
||||
echo "2: List configs"
|
||||
echo "3: Do local builds without testsuite"
|
||||
echo "4: Do local builds with testsuite"
|
||||
echo "5: Verify local testsuite results"
|
||||
echo "3: Verify quilt setup"
|
||||
echo "4: Do local builds without testsuite"
|
||||
echo "5: Do local builds with testsuite"
|
||||
echo "6: Verify local testsuite results"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
@ -120,8 +121,13 @@ case "$n" in
|
||||
done
|
||||
done
|
||||
;;
|
||||
|
||||
|
||||
3)
|
||||
quilt setup -d $root -v gdb.spec
|
||||
rm -Rf $root/gdb-*
|
||||
;;
|
||||
|
||||
4)
|
||||
acquire_sudo_rights
|
||||
|
||||
rm -Rf $logs/$n
|
||||
@ -155,7 +161,7 @@ case "$n" in
|
||||
done
|
||||
;;
|
||||
|
||||
4)
|
||||
5)
|
||||
acquire_sudo_rights
|
||||
|
||||
rm -Rf $logs/$n
|
||||
@ -214,7 +220,7 @@ case "$n" in
|
||||
done
|
||||
;;
|
||||
|
||||
5)
|
||||
6)
|
||||
for arch in $archs; do
|
||||
for c in $configs; do
|
||||
if ! have_combo $arch $c; then
|
||||
|
4
qa.sh
4
qa.sh
@ -282,7 +282,7 @@ kfail=(
|
||||
"FAIL: gdb.gdb/selftest.exp: backtrace through signal handler"
|
||||
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=29781
|
||||
"FAIL: gdb.mi/mi-multi-commands.exp: args=: look for second command output, command length .* \(timeout\)"
|
||||
"FAIL: gdb.mi/mi-multi-commands.exp: args=.*: look for second command output, command length .* \(timeout\)"
|
||||
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=27027
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=28464
|
||||
@ -530,6 +530,8 @@ kfail_aarch64=(
|
||||
"FAIL: gdb.mi/.*.exp:"
|
||||
"FAIL: gdb.python/.*-mi.exp:"
|
||||
"FAIL: gdb.python/py-mi-.*.exp:"
|
||||
"FAIL: gdb.ada/mi.*.exp:"
|
||||
"FAIL: gdb.base/annota.*.exp:"
|
||||
|
||||
) # kfail_aarch64
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user