From 5707e24baa2f557d54e09641d69843111834cb9b Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 7 Apr 2020 10:57:20 +0200 Subject: [gdb/symtab] Fix check-psymtab failure for inline function Consider test-case inline.c, containing an inline function foo: ... static inline int foo (void) { return 0; } int main (void) { return foo (); } ... And the test-case compiled with -O2 and debug info: ... $ gcc -g inline.c -O2 ... This results in a DWARF entry for foo without pc info: ... <1><114>: Abbrev Number: 4 (DW_TAG_subprogram) <115> DW_AT_name : foo <119> DW_AT_decl_file : 1 <11a> DW_AT_decl_line : 2 <11b> DW_AT_prototyped : 1 <11b> DW_AT_type : <0x10d> <11f> DW_AT_inline : 3 (declared as inline and inlined) ... When loading the executable in gdb, we create a partial symbol for foo, but after expansion into a full symbol table no actual symbol is created, resulting in a maint check-psymtab failure: ... (gdb) maint check-psymtab Static symbol `foo' only found in inline.c psymtab ... Fix this by skipping this type of partial symbol during the check. Note that we're not fixing this by not creating the partial symbol, because this breaks setting a breakpoint on an inlined inline function in a CU for which the partial symtab has not been expanded (test-case gdb.dwarf2/break-inline-psymtab.exp). Tested on x86_64-linux. gdb/ChangeLog: 2020-04-07 Tom de Vries * psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK symbols without address. gdb/testsuite/ChangeLog: 2020-04-07 Tom de Vries * gdb.base/check-psymtab.c: New test. * gdb.base/check-psymtab.exp: New file. --- gdb/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/ChangeLog') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bd1a0f4..16a0089 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-04-07 Tom de Vries + + * psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK + symbols without address. + 2020-04-06 Kamil Rytarowski * nbsd-nat.h (struct thread_info): Add forward declaration. -- cgit v1.1