1# Copyright 1997-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 17standard_testfile 18 19# This test must be compiled with -O2 if using gcc. 20 21set options debug 22if {[test_compiler_info gcc-*-*]} { 23 lappend options additional_flags=-O2 additional_flags=-fno-inline 24} 25 26if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options]} { 27 return -1 28} 29 30if {[runto middle]} { 31 # PR 3016 32 # warning: Hit heuristic-fence-post without finding 33 # warning: enclosing function for pc 0x1006ead0 34 if {[test_compiler_info gcc-*-*]} { 35 setup_xfail "mips64*-*-elf" 36 } 37 # The call chain is main -> top -> middle. But gcc can optimize a tail 38 # call to a jump, so the stack may contain either main -> top -> middle 39 # or main -> middle. 40 gdb_test "backtrace" "#0.*middle.*#\[12\].*main.*" 41} 42return 0 43