1# Copyright 2013-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/>. 15load_lib dwarf.exp 16 17standard_testfile .S 18 19# This test can only be run on targets which support DWARF-2 and use gas. 20if ![dwarf2_support] { 21 return 0 22} 23 24# This test can only be run on x86-64 targets. 25if {![istarget x86_64-*] || ![is_lp64_target]} { 26 return 0 27} 28 29if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile {nodebug nopie}]} { 30 return -1 31} 32 33if ![runto "stop_frame"] { 34 return -1 35} 36 37# stop_frame should be the outermost frame. 38 39# Check that backtrace shows only frame #0. 40gdb_test "bt" "#0\[ \]\+stop_frame \[^\r\n\]\+" 41 42# And that "up" doesn't work. 43gdb_test "up" \ 44 "Initial frame selected; you cannot go up\\." \ 45 "up refuses to go up" 46 47# "info frame" unwinds the PC for "saved ... = ". Make sure that 48# doesn't cause an error, and shows "<not saved>". 49gdb_test "info frame" [multi_line \ 50 "Stack level 0, frame at $hex\:" \ 51 " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <not saved>" \ 52 " Outermost frame: outermost" \ 53 " source language c\\." \ 54 " Arglist at $hex, args\: " \ 55 " Locals at $hex, Previous frame's sp is $hex" \ 56 " Saved registers\:" \ 57 " rbp at $hex.*" \ 58] 59