+2020-04-07 Tom de Vries <tdevries@suse.de>
+
+ * psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK
+ symbols without address.
+
2020-04-06 Kamil Rytarowski <n54@gmx.com>
* nbsd-nat.h (struct thread_info): Add forward declaration.
struct compunit_symtab *cust = NULL;
const struct blockvector *bv;
const struct block *b;
- int length;
+ int i;
for (objfile *objfile : current_program_space->objfiles ())
for (partial_symtab *ps : require_partial_symbols (objfile, true))
b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
partial_symbol **psym
= &objfile->partial_symtabs->static_psymbols[ps->statics_offset];
- length = ps->n_static_syms;
- while (length--)
+ for (i = 0; i < ps->n_static_syms; psym++, i++)
{
+ /* Skip symbols for inlined functions without address. These may
+ or may not have a match in the full symtab. */
+ if ((*psym)->aclass == LOC_BLOCK
+ && (*psym)->ginfo.value.address == 0)
+ continue;
+
sym = block_lookup_symbol (b, (*psym)->ginfo.search_name (),
symbol_name_match_type::SEARCH_NAME,
(*psym)->domain);
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
}
- psym++;
}
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
psym = &objfile->partial_symtabs->global_psymbols[ps->globals_offset];
- length = ps->n_global_syms;
- while (length--)
+ for (i = 0; i < ps->n_global_syms; psym++, i++)
{
sym = block_lookup_symbol (b, (*psym)->ginfo.search_name (),
symbol_name_match_type::SEARCH_NAME,
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
}
- psym++;
}
if (ps->raw_text_high () != 0
&& (ps->text_low (objfile) < BLOCK_START (b)
+2020-04-07 Tom de Vries <tdevries@suse.de>
+
+ * gdb.base/check-psymtab.c: New test.
+ * gdb.base/check-psymtab.exp: New file.
+
2020-04-06 Tom Tromey <tromey@adacore.com>
* gdb.ada/variant-record/proc.adb: New file.
--- /dev/null
+/* 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/>. */
+
+static inline int __attribute__((__always_inline__))
+foo (void)
+{
+ return 0;
+}
+
+int
+main (void)
+{
+ return foo ();
+}
--- /dev/null
+# 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/>. */
+
+standard_testfile
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
+ return -1
+}
+
+gdb_test_no_output "maint expand-symtabs"
+
+# Check that we don't get:
+# Static symbol `foo' only found in check-psymtab.c psymtab
+gdb_test_no_output "maint check-psymtab"