]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/ada] Fix -readnow FAILs
authorTom de Vries <tdevries@suse.de>
Thu, 2 Apr 2020 06:58:38 +0000 (08:58 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 2 Apr 2020 06:58:38 +0000 (08:58 +0200)
commit1aa98955b19676497f89112a0962f24f359ce761
tree92c522b4f8dcee539e56fcf883f4e3d567210d8b
parentd3214198119c1a2f9a6a2b8fcc56d8c324e1a245
[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.
gdb/ChangeLog
gdb/dwarf2/read.c