diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 393651799ef..98f4d17412e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2020-06-03 Tom de Vries + + PR symtab/26046 + * dwarf2/read.c (scan_partial_symbols): Recurse into DW_TAG_subprogram + children for C++. + (load_partial_dies): Don't skip DW_TAG_inlined_subroutine child of + DW_TAG_subprogram. + 2020-06-02 Andrew Burgess * ada-lang.c (ada_language_data): Delete skip_trampoline diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e6566f9649f..ac6c15e7b25 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8146,6 +8146,9 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc, case DW_TAG_subprogram: case DW_TAG_inlined_subroutine: add_partial_subprogram (pdi, lowpc, highpc, set_addrmap, cu); + if (cu->language == language_cplus) + scan_partial_symbols (pdi->die_child, lowpc, highpc, + set_addrmap, cu); break; case DW_TAG_constant: case DW_TAG_variable: @@ -18246,7 +18249,8 @@ load_partial_dies (const struct die_reader_specs *reader, if (!load_all && cu->language == language_cplus && parent_die != NULL - && parent_die->tag == DW_TAG_subprogram) + && parent_die->tag == DW_TAG_subprogram + && abbrev->tag != DW_TAG_inlined_subroutine) { info_ptr = skip_one_die (reader, info_ptr + bytes_read, abbrev); continue; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 21839c7c12b..21cfc17294e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-06-03 Tom de Vries + + PR symtab/26046 + * gdb.cp/breakpoint-locs-2.cc: New test. + * gdb.cp/breakpoint-locs.cc: New test. + * gdb.cp/breakpoint-locs.exp: New file. + * gdb.cp/breakpoint-locs.h: New test. + 2020-06-03 Tom de Vries PR testsuite/25609 diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc b/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc new file mode 100644 index 00000000000..8e0cce8fdd4 --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc @@ -0,0 +1,29 @@ +/* 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 . */ + +#include "breakpoint-locs.h" + +namespace N1 +{ + void bar () { C1::baz (); } +} + +void +N1_bar (void) +{ + N1::bar (); +} diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.cc b/gdb/testsuite/gdb.cp/breakpoint-locs.cc new file mode 100644 index 00000000000..d52a3f416fe --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint-locs.cc @@ -0,0 +1,33 @@ +/* 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 . */ + +#include "breakpoint-locs.h" + +namespace N1 +{ + void foo () { C1::baz (); } +} + +extern void N1_bar (void); + +int +main () +{ + N1::foo (); + N1_bar (); + return 0; +} diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.exp b/gdb/testsuite/gdb.cp/breakpoint-locs.exp new file mode 100644 index 00000000000..46b64e9de64 --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint-locs.exp @@ -0,0 +1,27 @@ +# 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 . + +# This file is part of the gdb testsuite + +if {[skip_cplus_tests]} { continue } + +standard_testfile .cc breakpoint-locs-2.cc + +if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"\ + {debug c++}] } { + return -1 +} + +gdb_test "break N1::C1::baz" "\\(2 locations\\)" diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.h b/gdb/testsuite/gdb.cp/breakpoint-locs.h new file mode 100644 index 00000000000..61af5943968 --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint-locs.h @@ -0,0 +1,25 @@ +/* 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 . */ + +namespace N1 +{ + class C1 + { + public: + static void __attribute__((always_inline)) baz () { volatile unsigned i; i++; } + }; +}