summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.opt/inline-bt.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.opt/inline-bt.exp')
-rw-r--r--gdb/testsuite/gdb.opt/inline-bt.exp63
1 files changed, 63 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
new file mode 100644
index 00000000000..10325ab833b
--- /dev/null
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -0,0 +1,63 @@
+# Copyright 2008 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/>.
+
+set testfile "inline-bt"
+set srcfile ${testfile}.c
+set srcfile2 "inline-markers.c"
+set fullsrcfile "${srcdir}/${subdir}/${srcfile}"
+set fullsrcfile2 "${srcdir}/${subdir}/${srcfile2}"
+set sources [list ${fullsrcfile} ${fullsrcfile2}]
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile ${sources} ${binfile} \
+ executable {debug optimize=-O2}] != "" } {
+ untested inline-bt.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+runto_main
+
+get_compiler_info $binfile
+get_debug_format
+if { [skip_inline_frame_tests] } {
+ untested inline-bt.exp
+ return
+}
+
+set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
+gdb_breakpoint $srcfile2:$line1
+
+gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (1)"
+gdb_test "backtrace" "#0 bar.*#1 .*main.*" "backtrace from bar (1)"
+gdb_test "info frame" ".*called by frame.*" "bar not inlined"
+
+gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (2)"
+gdb_test "backtrace" "#0 bar.*#1 .*func1.*#2 .*main.*" \
+ "backtrace from bar (2)"
+gdb_test "up" "#1 .*func1.*" "up from bar (2)"
+gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (2)"
+
+gdb_test "continue" ".*set breakpoint 1 here.*" "continue to bar (3)"
+gdb_test "backtrace" "#0 bar.*#1 .*func1.*#2 .*func2.*#3 .*main.*" \
+ "backtrace from bar (3)"
+gdb_test "up" "#1 .*func1.*" "up from bar (3)"
+gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (3)"
+gdb_test "up" "#2 .*func2.*" "up from func1 (3)"
+gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (3)"