]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch 'gdb_7_3-branch'.
authornobody <>
Mon, 25 Apr 2011 19:38:17 +0000 (19:38 +0000)
committernobody <>
Mon, 25 Apr 2011 19:38:17 +0000 (19:38 +0000)
Cherrypick from master 2011-04-25 19:38:16 UTC Jan Kratochvil <jan.kratochvil@redhat.com> '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 [new file with mode: 0644]
gdb/testsuite/gdb.base/gdbindex-stabs.c [new file with mode: 0644]
gdb/testsuite/gdb.base/gdbindex-stabs.exp [new file with mode: 0644]
gdb/testsuite/gdb.python/py-frame-inline.c [new file with mode: 0644]
gdb/testsuite/gdb.python/py-frame-inline.exp [new file with mode: 0644]

diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c b/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c
new file mode 100644 (file)
index 0000000..f5cbe3c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>. */
+
+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 (file)
index 0000000..2e8f9c6
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>. */
+
+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 (file)
index 0000000..0167fc9
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 (file)
index 0000000..d88e666
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.  */
+
+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 (file)
index 0000000..f3c85d9
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+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"