1# Copyright 2018-2020 Free Software Foundation, Inc. 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15# 16# This file is part of the gdb testsuite. 17 18# This test was added to test GDB's ability to backtrace over a large 19# stack frame for which there is no debug information. This should 20# test the non-DWARF stack unwinder. 21# 22# The test was originally added for Risc-V where this case caused a 23# problem at one point, however, there's nothing Risc-V specific in 24# the test. 25 26proc run_test { opt_level } { 27 global srcfile srcfile2 binfile hex 28 29 standard_testfile large-frame-1.c large-frame-2.c 30 31 if {[prepare_for_testing_full "failed to prepare" \ 32 [list ${binfile}-${opt_level} debug \ 33 $srcfile [list debug] \ 34 $srcfile2 [list nodebug optimize=-$opt_level]]]} { 35 return 36 } 37 38 if { ![runto_main] } then { 39 unsupported "runto main" 40 return 41 } 42 43 gdb_breakpoint "blah" 44 gdb_continue_to_breakpoint "blah" 45 46 gdb_test "backtrace" [multi_line \ 47 "#0 blah \[^\n\r\]+" \ 48 "#1 $hex in func \[^\n\r\]+" \ 49 "#2 $hex in main \[^\n\r\]+"] 50} 51 52foreach opt { O0 O1 O2 } { 53 with_test_prefix "optimize=-$opt" { 54 run_test $opt 55 } 56} 57 58