1# Copyright 2007-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 16standard_testfile .c 17if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { 18 untested "failed to compile" 19 return -1 20} 21 22clean_restart ${binfile} 23 24if {![runto break_me]} { 25 return 26} 27 28# Test with "print frame-arguments" set to "all" 29 30gdb_test_no_output "set print frame-arguments all" \ 31 "set print frame-arguments all" 32gdb_test "frame 1" \ 33 ".*in call_me \\(i=3, f=5, s=({a = 3, b = 5}|<optimized out>), ss=0x\[0-9a-f\]\+, u=({.*}|<optimized out>), e=green\\) at .*frame-args\\.c:.*" \ 34 "frame 1 with print frame-arguments set to all" 35 36# Test with "print frame-arguments" set to "scalars" 37 38gdb_test_no_output "set print frame-arguments scalars" \ 39 "set print frame-arguments scalars" 40gdb_test "frame 1" \ 41 ".*in call_me \\(i=3, f=5, s=\\.\\.\\., ss=0x\[0-9a-f\]\+, u=\\.\\.\\., e=green\\) at .*frame-args\\.c:.*" \ 42 "frame 1 with print frame-arguments set to scalars" 43 44# Test with "print frame-arguments" set to "none" 45 46gdb_test_no_output "set print frame-arguments none" \ 47 "set print frame-arguments none" 48gdb_test "frame 1" \ 49 ".*in call_me \\(i=\\.\\.\\., f=\\.\\.\\., s=\\.\\.\\., ss=\\.\\.\\., u=\\.\\.\\., e=\\.\\.\\.\\) at .*frame-args\\.c:.*" \ 50 "frame 1 with print frame-arguments set to none" 51 52# Test with "print frame-arguments" set to "presence" 53 54gdb_test_no_output "set print frame-arguments presence" \ 55 "set print frame-arguments presence" 56gdb_test "frame 1" \ 57 ".*in call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ 58 "frame 1 with print frame-arguments set to presence" 59gdb_test "frame 2" \ 60 ".*in main \\(\\) at .*frame-args\\.c:.*" \ 61 "frame 2 (no args) with print frame-arguments set to presence" 62 63 64# Test with "print frame-info" set to "location-and-address" 65gdb_test_no_output "set print frame-info location-and-address" \ 66 "set print frame-info location-and-address" 67gdb_test "frame 1" \ 68 ".*0x.* in call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ 69 "frame 1 with print frame-info set to location-and-address" 70 71# Test with "print address" set to "off" ... 72gdb_test_no_output "set print address off" \ 73 "set print address off" 74 75# ... and "location-and-address" (previously set) 76gdb_test "frame 1" \ 77 "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ 78 "frame 1 with print frame-info set to location-and-address and address off" 79 80# ... and "location" 81gdb_test_no_output "set print frame-info location" \ 82 "set print frame-info location" 83gdb_test "frame 1" \ 84 "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ 85 "frame 1 with print frame-info set to location and address off" 86 87# ... and "short-location" 88gdb_test_no_output "set print frame-info short-location" \ 89 "set print frame-info short-location" 90gdb_test "frame 1" \ 91 "#1 call_me \\(\\.\\.\\.\\)" \ 92 "frame 1 with print frame-info set to short-location and address off" 93 94# ... and "source-and-location" 95gdb_test_no_output "set print frame-info source-and-location" \ 96 "set print frame-info source-and-location" 97gdb_test "frame 1" \ 98 "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*\r\n\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);" \ 99 "frame 1 with print frame-info set to source-and-location and address off" 100 101# ... and "source-line". 102gdb_test_no_output "set print frame-info source-line" \ 103 "set print frame-info source-line" 104gdb_test "frame 1" \ 105 "\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);" \ 106 "frame 1 with print frame-info set to source-line and address off" 107 108 109# Verify overriding of the global setting by the backtrace -frame-info option. 110gdb_test "backtrace -frame-info source-and-location 2" \ 111 ".*\r\n.*\r\n#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*\r\n\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);.*" \ 112 "backtrace -frame-info source-and-location 2 overriding print frame-info set to source-line" 113