diff options
author | Tom de Vries <tdevries@suse.de> | 2020-05-20 11:48:39 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-05-20 11:48:39 +0200 |
commit | 9a0bacfb08eb87938919023915ecc0ca2ba21223 (patch) | |
tree | 2d5e055ca530385b3a022cf9b6b7902bce000c76 /gdb/testsuite/gdb.base/with-mf-main.c | |
parent | 7b958a48e1322880f23cdb0a1c35643dd27d3ddb (diff) | |
download | gdb-9a0bacfb08eb87938919023915ecc0ca2ba21223.zip gdb-9a0bacfb08eb87938919023915ecc0ca2ba21223.tar.gz gdb-9a0bacfb08eb87938919023915ecc0ca2ba21223.tar.bz2 |
[gdb/symtab] Handle .gdb_index in ada language mode
When running test-case gdb.base/with.exp with target board cc-with-gdb-index,
we have:
...
(gdb) PASS: gdb.base/with.exp: basics: show language
with language ada -- print g_s^M
'g_s' has unknown type; cast it to its declared type^M
(gdb) FAIL: gdb.base/with.exp: basics: with language ada -- print g_s
...
This is due to this bit in dw2_map_matching_symbols:
...
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;
}
...
While the reasoning in the comment may be sound from language perspective, it
does introduce an inconsistency in gdb behaviour between:
- having a .gdb_index section, and
- having a .gdb_names section, or a partial symtab, or -readnow.
Fix the inconsistency by completing implementation of
dw2_map_matching_symbols.
Tested on x86_64-linux, both with native and target board
cc-with-debug-index.
gdb/ChangeLog:
2020-05-20 Tom de Vries <tdevries@suse.de>
PR symtab/25833
* dwarf2/read.c (dw2_map_matching_symbols): Handle .gdb_index.
gdb/testsuite/ChangeLog:
2020-05-20 Tom de Vries <tdevries@suse.de>
PR symtab/25833
* gdb.base/with-mf-inc.c: New test.
* gdb.base/with-mf-main.c: New test.
* gdb.base/with-mf.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/with-mf-main.c')
-rw-r--r-- | gdb/testsuite/gdb.base/with-mf-main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/with-mf-main.c b/gdb/testsuite/gdb.base/with-mf-main.c new file mode 100644 index 0000000..b50d98f --- /dev/null +++ b/gdb/testsuite/gdb.base/with-mf-main.c @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2020 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/>. */ + +/* Main part of with.c. */ + +extern void inc (void); + +int +main () +{ + inc (); + + return 0; +} |