public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/ada] Fix -readnow FAILs
@ 2020-04-02 6:58 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-04-02 6:58 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1aa98955b19676497f89112a0962f24f359ce761
commit 1aa98955b19676497f89112a0962f24f359ce761
Author: Tom de Vries <tdevries@suse.de>
Date: Thu Apr 2 08:58:38 2020 +0200
[gdb/ada] Fix -readnow FAILs
When running test-case gdb.ada/access_to_packed_array we have:
...
(gdb) print pack.a^M
$1 = (0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)^M
...
but with target board readnow.exp, we have instead:
...
(gdb) print pack.a^M
'pack.a' has unknown type; cast it to its declared type^M
...
The symbol is normally found by the map_matching_symbols call in
ada-lang.c:add_nonlocal_symbols:
...
for (objfile *objfile : current_program_space->objfiles ())
{
data.objfile = objfile;
objfile->sf->qf->map_matching_symbols (objfile, lookup_name,
domain, global, callback,
(is_wild_match
? NULL : compare_names));
...
which maps onto psym_map_matching_symbols.
Function psym_map_matching_symbols iterates over all the partial symtabs,
and:
- if not expanded, searches in the partial symtab:
- if not found, continues to the next
- if found, expands into full symtab
- searches in the full symtab
However, with -readnow the call maps onto dw2_map_matching_symbols instead,
which is unimplemented, and consequently no symbol is found.
Fix this by detecting -readnow in dw2_map_matching_symbols, and handling that
appropriately given that partial symtabs are not present, and full symtabs
are: iterate over all the symtabs and search them.
Tested on x86_64-linux, with native and target board -readnow.
This removes 217 FAILs with board -readnow.
gdb/ChangeLog:
2020-04-02 Tom de Vries <tdevries@suse.de>
PR ada/24671
* dwarf2/read.c (dw2_map_matching_symbols): Handle -readnow.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2/read.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d5a2ed8fdef..a6e0ec9d522 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-02 Tom de Vries <tdevries@suse.de>
+
+ PR ada/24671
+ * dwarf2/read.c (dw2_map_matching_symbols): Handle -readnow.
+
2020-04-02 Tom de Vries <tdevries@suse.de>
* dwarf2/read.c (dwarf2_gdb_index_functions,
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 198fac0f416..f94c66b4f1b 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3592,9 +3592,35 @@ dw2_map_matching_symbols
gdb::function_view<symbol_found_callback_ftype> callback,
symbol_compare_ftype *ordered_compare)
{
- /* Currently unimplemented; used for Ada. The function can be called if the
- current language is Ada for a non-Ada objfile using GNU index. As Ada
- does not look for non-Ada symbols this function should just return. */
+ /* Used for Ada. */
+ struct dwarf2_per_objfile *dwarf2_per_objfile
+ = get_dwarf2_per_objfile (objfile);
+
+ if (dwarf2_per_objfile->index_table != nullptr)
+ {
+ /* Ada currently doesn't support .gdb_index (see PR24713). We can get
+ here though if the current language is Ada for a non-Ada objfile
+ using GNU index. As Ada does not look for non-Ada symbols this
+ function should just return. */
+ return;
+ }
+
+ /* We have -readnow: no .gdb_index, but no partial symtabs either. So,
+ inline psym_map_matching_symbols here, assuming all partial symtabs have
+ been read in. */
+ const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
+
+ for (compunit_symtab *cust : objfile->compunits ())
+ {
+ const struct block *block;
+
+ if (cust == NULL)
+ continue;
+ block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
+ if (!iterate_over_symbols_terminated (block, name,
+ domain, callback))
+ return;
+ }
}
/* Starting from a search name, return the string that finds the upper
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-02 6:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 6:58 [binutils-gdb] [gdb/ada] Fix -readnow FAILs Tom de Vries
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).