[gdb/symtab] Fix name lookup in dw2_map_matching_symbols
authorTom de Vries <tdevries@suse.de>
Wed, 10 Jun 2020 12:46:53 +0000 (14:46 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 10 Jun 2020 12:46:53 +0000 (14:46 +0200)
commite5f3ece2ab3b14677c87d9694d822c9ee01b36fe
treea3d298550febe9d946af4f99b695edf00f538534
parente1b5d517d1c293a64df311d2749bbbbfbe035a4c
[gdb/symtab] Fix name lookup in dw2_map_matching_symbols

In commit 9a0bacfb08 "[gdb/symtab] Handle .gdb_index in ada language mode", a
missing part of dw2_map_matching_symbols was added, containing a call to
dw2_expand_symtabs_matching_symbol.

However, the callback passed to that call has one problem: the callback has an
argument "offset_type namei", which is ignored.  Instead, match_name is passed
as argument to dw2_symtab_iter_init, where a name lookup is done, which may or
may not yield the same value as namei.

Fix this by creating a new version of dw2_symtab_iter_init that takes a
"offset_type namei" argument instead of "const char *name", and passing namei.

Tested on x86_64-linux, with native and target board cc-with-gdb-index.

gdb/ChangeLog:

2020-06-10  Tom de Vries  <tdevries@suse.de>

* dwarf2/read.c (dw2_symtab_iter_init_common): Factor out of ...
(dw2_symtab_iter_init): ... here.  Add variant with "offset_type
namei" instead of "const char *name" argument.
(dw2_map_matching_symbols): Use "offset_type namei" variant of
dw2_symtab_iter_init.
gdb/ChangeLog
gdb/dwarf2/read.c