From 9bd8032fd1774ec2fa64efea18ef550563af141f Mon Sep 17 00:00:00 2001 From: nobody <> Date: Mon, 25 Apr 2011 19:38:17 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'gdb_7_3-branch'. Cherrypick from master 2011-04-25 19:38:16 UTC Jan Kratochvil 'gdb/': gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c gdb/testsuite/gdb.base/gdbindex-stabs.c gdb/testsuite/gdb.base/gdbindex-stabs.exp gdb/testsuite/gdb.python/py-frame-inline.c gdb/testsuite/gdb.python/py-frame-inline.exp --- gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c | 25 +++++++++++ gdb/testsuite/gdb.base/gdbindex-stabs.c | 21 +++++++++ gdb/testsuite/gdb.base/gdbindex-stabs.exp | 36 ++++++++++++++++ gdb/testsuite/gdb.python/py-frame-inline.c | 43 +++++++++++++++++++ gdb/testsuite/gdb.python/py-frame-inline.exp | 39 +++++++++++++++++ 5 files changed, 164 insertions(+) create mode 100644 gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c create mode 100644 gdb/testsuite/gdb.base/gdbindex-stabs.c create mode 100644 gdb/testsuite/gdb.base/gdbindex-stabs.exp create mode 100644 gdb/testsuite/gdb.python/py-frame-inline.c create mode 100644 gdb/testsuite/gdb.python/py-frame-inline.exp diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c b/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c new file mode 100644 index 00000000000..f5cbe3c5c24 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 void stabs_function (void); + +int +main (void) +{ + stabs_function (); + return 0; +} diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs.c b/gdb/testsuite/gdb.base/gdbindex-stabs.c new file mode 100644 index 00000000000..2e8f9c68e5c --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbindex-stabs.c @@ -0,0 +1,21 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 . */ + +void +stabs_function (void) /* marker-here */ +{ +} diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs.exp b/gdb/testsuite/gdb.base/gdbindex-stabs.exp new file mode 100644 index 00000000000..0167fc9d976 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbindex-stabs.exp @@ -0,0 +1,36 @@ +# Copyright (C) 2011 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 problem is reproducible only when using `gdb/cc-with-index.sh'. + +set testfile gdbindex-stabs +set executable ${testfile} +set binfile ${objdir}/${subdir}/${executable} +set srcfile_stabs ${testfile}.c +set srcfile_dwarf ${testfile}-dwarf.c +set objfile_stabs ${testfile}.o +set objfile_dwarf ${testfile}-dwarf.o + +if {[gdb_compile "${srcdir}/${subdir}/${srcfile_stabs}" ${objfile_stabs} object {additional_flags=-gstabs}] != "" + || [gdb_compile "${srcdir}/${subdir}/${srcfile_dwarf}" ${objfile_dwarf} object {additional_flags=-gdwarf-2}] != "" + || [gdb_compile "${objfile_stabs} ${objfile_dwarf}" ${binfile} executable {nodebug}] != ""} { + untested ${testfile}.exp + return -1 +} + +clean_restart ${executable} + +# FAIL was: No line number known for stabs_function. +gdb_test "list stabs_function" " marker-here .*" diff --git a/gdb/testsuite/gdb.python/py-frame-inline.c b/gdb/testsuite/gdb.python/py-frame-inline.c new file mode 100644 index 00000000000..d88e666a6b8 --- /dev/null +++ b/gdb/testsuite/gdb.python/py-frame-inline.c @@ -0,0 +1,43 @@ +/* This test is part of GDB, the GNU debugger. + + Copyright 2011 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 . */ + +volatile int v = 42; + +__attribute__((__always_inline__)) static int +f (void) +{ + /* Provide first stub line so that GDB understand the PC is already inside + the inlined function and does not expect a step into it. */ + v++; + v++; /* break-here */ + + return v; +} + +__attribute__((__noinline__)) static int +g (void) +{ + volatile int l = v; + + return f (); +} + +int +main (void) +{ + return g (); +} diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp new file mode 100644 index 00000000000..f3c85d93d6e --- /dev/null +++ b/gdb/testsuite/gdb.python/py-frame-inline.exp @@ -0,0 +1,39 @@ +# Copyright (C) 2011 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 . + +load_lib gdb-python.exp + +set testfile "py-frame-inline" +set srcfile ${testfile}.c +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } + +if ![runto main] then { + fail "Can't run to function f" + return 0 +} + +gdb_breakpoint [gdb_get_line_number "break-here"] +gdb_continue_to_breakpoint "Block break here." + +gdb_test "info frame" "inlined into frame 1\r\n.*" + +gdb_test "up" "#1 g .*" + +gdb_test "python print gdb.selected_frame().read_var('l')" "\r\n42" -- 2.47.2