From: Tom de Vries Date: Wed, 18 Mar 2020 13:40:49 +0000 (+0100) Subject: [gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a9933ccf467ac771747db9dba541afdf1b72a3f8;p=binutils-gdb.git [gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.exp Add a test-case that tests whether we can set a breakpoint on an inlined inline function in CU for which the partial symtab has not yet been expanded. Tested on x86_64-linux, with gcc 4.8.5, gcc-7.5.0, gcc-10.0.1, and clang 5.0.2. gdb/testsuite/ChangeLog: 2020-03-18 Tom de Vries * gdb.dwarf2/break-inline-psymtab-2.c: New test. * gdb.dwarf2/break-inline-psymtab.c: New test. * gdb.dwarf2/break-inline-psymtab.exp: New file. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c0b5a3aba85..ba14abb2c6e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-03-18 Tom de Vries + + * gdb.dwarf2/break-inline-psymtab-2.c: New test. + * gdb.dwarf2/break-inline-psymtab.c: New test. + * gdb.dwarf2/break-inline-psymtab.exp: New file. + 2020-03-16 Tom de Vries * lib/cache.exp (gdb_do_cache): Add and handle local variables diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c new file mode 100644 index 00000000000..38c69336f20 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c @@ -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 . */ + +extern int foo (void); + +int a; + +static inline int +bar (void) +{ + a = 2; + return 0; +} + +int +foo (void) +{ + return bar (); +} diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c new file mode 100644 index 00000000000..74cea4bf90d --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c @@ -0,0 +1,24 @@ +/* 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 . */ + +extern int foo (void); + +int +main (void) +{ + return foo (); +} diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp new file mode 100644 index 00000000000..adbe8620aa7 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp @@ -0,0 +1,36 @@ +# Copyright 2019-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 . + +standard_testfile break-inline-psymtab.c break-inline-psymtab-2.c + +set sources [list $srcfile $srcfile2] +set opts {debug optimize=-O2} +if { [prepare_for_testing "failed to prepare" ${testfile} $sources $opts] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +get_compiler_info +get_debug_format +if { [skip_inline_frame_tests] } { + return -1 +} + +# Set a break-point in inline function bar, in a CU for which the partial +# symtab has not been expanded. +gdb_breakpoint "bar" message