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