Update copyright year range in all GDB files.
[external/binutils.git] / gdb / testsuite / gdb.opt / inline-bt.exp
index 6b35690..76a7948 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+# Copyright 2008-2019 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
 # 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 additional_flags=-Winline}] != "" } {
-    untested inline-bt.exp
+standard_testfile .c inline-markers.c
+
+if {[prepare_for_testing "failed to prepare" $testfile \
+        [list $srcfile $srcfile2] \
+        {debug additional_flags=-Winline}]} {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 runto_main
 
-get_compiler_info $binfile
+get_compiler_info
 get_debug_format
 if { [skip_inline_frame_tests] } {
-    untested inline-bt.exp
+    untested "skipping inline frame tests"
     return
 }
 
@@ -61,3 +50,19 @@ 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)"
+
+# A regression test for having a backtrace limit that forces unwinding
+# to stop after an inline frame.  GDB needs to compute the frame_id of
+# the inline frame, which requires unwinding past all the inline
+# frames to the real stack frame, even if that means bypassing the
+# user visible backtrace limit.  See PR backtrace/15558.
+#
+# Set a backtrace limit that forces an unwind stop after an inline
+# function.
+gdb_test_no_output "set backtrace limit 2"
+# Force flushing the frame cache.
+gdb_test "flushregs" "Register cache flushed."
+gdb_test "up" "#1  .*func1.*" "up from bar (4)"
+gdb_test "info frame" ".*in func1.*" "info frame still works"
+# Verify the user visible limit works as expected.
+gdb_test "up" "Initial frame selected; you cannot go up." "up hits limit"