1# Copyright 2018-2023 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 18if { [is_remote host] } { 19 gdb_remote_download host $srcdir/$subdir/large-frame.h 20} 21 22# This test was added to test GDB's ability to backtrace over a large 23# stack frame for which there is no debug information. This should 24# test the non-DWARF stack unwinder. 25# 26# The test was originally added for Risc-V where this case caused a 27# problem at one point, however, there's nothing Risc-V specific in 28# the test. 29 30proc run_test { opt_level } { 31 global srcfile srcfile2 binfile hex 32 33 standard_testfile large-frame-1.c large-frame-2.c 34 35 if {[prepare_for_testing_full "failed to prepare" \ 36 [list ${binfile}-${opt_level} debug \ 37 $srcfile [list debug] \ 38 $srcfile2 [list nodebug optimize=-$opt_level]]]} { 39 return 40 } 41 42 if {![runto_main]} { 43 return 44 } 45 46 gdb_breakpoint "blah" 47 gdb_continue_to_breakpoint "blah" 48 49 gdb_test "backtrace" [multi_line \ 50 "#0 blah \[^\n\r\]+" \ 51 "#1 $hex in func \[^\n\r\]+" \ 52 "#2 $hex in main \[^\n\r\]+"] 53} 54 55foreach opt { O0 O1 O2 } { 56 with_test_prefix "optimize=-$opt" { 57 run_test $opt 58 } 59} 60 61