- Patches added (backport from master):
* gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch - Patches dropped (requires unsupported command): * gdb-testsuite-add-wait-for-index-cache-in-gdb.dwarf2.patch - Maintenance script qa.sh: * Added PR30528 kfail. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=366
This commit is contained in:
parent
7cb3ecbb8b
commit
ee9e61fe99
81
gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
Normal file
81
gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
Normal file
@ -0,0 +1,81 @@
|
||||
From 04d0d6ebdc6d08f5a7ec0d4c89eb1835deef54dc Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Sun, 13 Aug 2023 14:08:06 +0200
|
||||
Subject: [PATCH] [gdb/symtab] Don't deduplicate variables in gdb-index
|
||||
|
||||
When running test-case gdb.python/py-symbol.exp with target board
|
||||
cc-with-gdb-index, we run into:
|
||||
...
|
||||
(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
|
||||
1^M
|
||||
(gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
|
||||
...
|
||||
|
||||
[ Note that the test-case contains rr in both py-symtab.c:
|
||||
...
|
||||
static int __attribute__ ((used)) rr = 42; /* line of rr */
|
||||
...
|
||||
and py-symtab-2.c:
|
||||
...
|
||||
static int __attribute__ ((used)) rr = 99; /* line of other rr */
|
||||
... ]
|
||||
|
||||
This passes with gdb-12-branch, and fails with gdb-13-branch.
|
||||
|
||||
AFAIU the current code in symtab_index_entry::minimize makes the assumption
|
||||
that it's fine to store only one copy of rr in the gdb-index, because
|
||||
"print rr" will only ever print one, and always the same.
|
||||
|
||||
But that fails to recognize that gdb supports gdb.lookup_static_symbols, which
|
||||
returns a list of variables rather than the first one.
|
||||
|
||||
In other words, the current approach breaks feature parity between cooked
|
||||
index and gdb-index.
|
||||
|
||||
Note btw that also debug-names has both instances:
|
||||
...
|
||||
[ 5] #00597969 rr:
|
||||
<4> DW_TAG_variable DW_IDX_compile_unit=3 DW_IDX_GNU_internal=1
|
||||
<4> DW_TAG_variable DW_IDX_compile_unit=4 DW_IDX_GNU_internal=1
|
||||
...
|
||||
|
||||
Fix this in symtab_index_entry::minimize, by not deduplicating variables.
|
||||
|
||||
Tested on x86_64-linux, with target boards unix and cc-with-gdb-index.
|
||||
|
||||
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
|
||||
|
||||
PR symtab/30720
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30720
|
||||
---
|
||||
gdb/dwarf2/index-write.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
|
||||
index d10583568c0..ea67f73ac3c 100644
|
||||
--- a/gdb/dwarf2/index-write.c
|
||||
+++ b/gdb/dwarf2/index-write.c
|
||||
@@ -294,7 +294,7 @@ symtab_index_entry::minimize ()
|
||||
auto from = std::unique (cu_indices.begin (), cu_indices.end ());
|
||||
cu_indices.erase (from, cu_indices.end ());
|
||||
|
||||
- /* We don't want to enter a variable or type more than once, so
|
||||
+ /* We don't want to enter a type more than once, so
|
||||
remove any such duplicates from the list as well. When doing
|
||||
this, we want to keep the entry from the first CU -- but this is
|
||||
implicit due to the sort. This choice is done because it's
|
||||
@@ -304,8 +304,7 @@ symtab_index_entry::minimize ()
|
||||
[&] (offset_type val)
|
||||
{
|
||||
gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val);
|
||||
- if (kind != GDB_INDEX_SYMBOL_KIND_TYPE
|
||||
- && kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
|
||||
+ if (kind != GDB_INDEX_SYMBOL_KIND_TYPE)
|
||||
return false;
|
||||
|
||||
val &= ~GDB_INDEX_CU_MASK;
|
||||
|
||||
base-commit: 2521ac7ed0c495b9e804c4356939b9be7166853c
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 2521ac7ed0c495b9e804c4356939b9be7166853c Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 26 Oct 2023 10:34:24 +0200
|
||||
Subject: [PATCH] [gdb/testsuite] Add wait-for-index-cache in
|
||||
gdb.dwarf2/per-bfd-sharing.exp
|
||||
|
||||
If we make writing an index-cache entry very slow by doing this in
|
||||
index_cache::store:
|
||||
...
|
||||
try
|
||||
{
|
||||
+ sleep (15);
|
||||
index_cache_debug ("writing index cache for objfile %s",
|
||||
bfd_get_filename (per_bfd->obfd));
|
||||
...
|
||||
we run into:
|
||||
...
|
||||
FAIL: gdb.dwarf2/per-bfd-sharing.exp: \
|
||||
couldn't remove files in temporary cache dir
|
||||
...
|
||||
|
||||
The FAIL happens because there is no index-cache entry in the cache dir.
|
||||
|
||||
The problem is that gdb is killed (by gdb_exit) before the index-cache entry
|
||||
is written.
|
||||
|
||||
Fix this by using "maint wait-for-index-cache".
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
PR testsuite/30528
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30528
|
||||
---
|
||||
gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
|
||||
index 46284c2b775..7bdf59fbcd1 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
|
||||
@@ -47,6 +47,7 @@ with_test_prefix "populate index cache" {
|
||||
"set index-cache directory"
|
||||
gdb_test_no_output "set index-cache enabled on"
|
||||
gdb_test "file $binfile" "Reading symbols from .*" "file"
|
||||
+ gdb_test_no_output "maint wait-for-index-cache"
|
||||
}
|
||||
|
||||
proc load_binary { method } {
|
||||
|
||||
base-commit: b7f9471d211d35eba33b86e073268b4a89b78a92
|
||||
--
|
||||
2.35.3
|
||||
|
10
gdb.changes
10
gdb.changes
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 26 09:24:04 UTC 2023 - Tom de Vries <tdevries@suse.com>
|
||||
|
||||
- Patches added (backport from master):
|
||||
* gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
|
||||
- Patches dropped (requires unsupported command):
|
||||
* gdb-testsuite-add-wait-for-index-cache-in-gdb.dwarf2.patch
|
||||
- Maintenance script qa.sh:
|
||||
* Added PR30528 kfail.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 24 13:39:35 UTC 2023 - Tom de Vries <tdevries@suse.com>
|
||||
|
||||
|
4
gdb.spec
4
gdb.spec
@ -330,11 +330,11 @@ Patch2036: gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch
|
||||
Patch2037: gdb-cli-handle-pending-c-after-rl_callback_read_char.patch
|
||||
Patch2038: gdb-testsuite-add-have_host_locale.patch
|
||||
Patch2039: gdb-symtab-find-main-language-without-symtab-expansi.patch
|
||||
Patch2040: gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
|
||||
|
||||
# Backports from master, not yet available in next release.
|
||||
|
||||
Patch2070: gdb-symtab-work-around-pr-gas-29517.patch
|
||||
Patch2071: gdb-testsuite-add-wait-for-index-cache-in-gdb.dwarf2.patch
|
||||
|
||||
# Backport from gdb-patches
|
||||
|
||||
@ -766,9 +766,9 @@ find -name "*.info*"|xargs rm -f
|
||||
%patch2037 -p1
|
||||
%patch2038 -p1
|
||||
%patch2039 -p1
|
||||
%patch2040 -p1
|
||||
|
||||
%patch2070 -p1
|
||||
%patch2071 -p1
|
||||
|
||||
%patch2100 -p1
|
||||
%patch2101 -p1
|
||||
|
3
qa.sh
3
qa.sh
@ -303,6 +303,9 @@ kfail=(
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=30521
|
||||
"FAIL: gdb.base/printcmds.exp: print {unsigned char\[\]}{0xffffffff}"
|
||||
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=30528
|
||||
"FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir"
|
||||
|
||||
) # kfail
|
||||
|
||||
kfail_sle12=(
|
||||
|
Loading…
x
Reference in New Issue
Block a user