]>
Commit | Line | Data |
---|---|---|
8acc9f48 | 1 | # Copyright 2009-2013 Free Software Foundation, Inc. |
f61e138d SS |
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 | load_lib "trace-support.exp"; | |
17 | ||
f61e138d SS |
18 | |
19 | gdb_exit | |
20 | gdb_start | |
497a5eb0 | 21 | standard_testfile actions.c |
f61e138d SS |
22 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
23 | executable {debug nowarnings}] != "" } { | |
0914bcdb | 24 | untested tsv.exp |
f61e138d SS |
25 | return -1 |
26 | } | |
0914bcdb | 27 | gdb_load $binfile |
f61e138d SS |
28 | |
29 | gdb_test "tvariable \$tvar1" \ | |
30 | "Trace state variable \\\$tvar1 created, with initial value 0." \ | |
31 | "Create a trace state variable" | |
32 | ||
33 | gdb_test "tvariable \$tvar2 = 45" \ | |
34 | "Trace state variable \\\$tvar2 created, with initial value 45." \ | |
35 | "Create a trace state variable with initial value" | |
36 | ||
37 | gdb_test "tvariable \$tvar2 = -92" \ | |
38 | "Trace state variable \\\$tvar2 now has initial value -92." \ | |
39 | "Change initial value of a trace state variable" | |
40 | ||
41 | gdb_test "tvariable \$tvar3 = 2 + 3" \ | |
42 | "Trace state variable \\\$tvar3 created, with initial value 5." \ | |
43 | "Create a trace state variable with expression" | |
44 | ||
45 | gdb_test "tvariable \$tvar3 = 1234567000000" \ | |
46 | "Trace state variable \\\$tvar3 now has initial value 1234567000000." \ | |
47 | "Init trace state variable to a 64-bit value" | |
48 | ||
49 | gdb_test "tvariable main" \ | |
50 | "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \ | |
51 | "tvariable syntax error, bad name" | |
52 | ||
53 | gdb_test "tvariable \$tvar1 - 93" \ | |
54 | "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \ | |
55 | "tvariable syntax error, not an assignment" | |
56 | ||
57 | gdb_test "info tvariables" \ | |
58 | "Name\[\t \]+Initial\[\t \]+Current.* | |
59 | \\\$tvar1\[\t \]+0\[\t \]+<undefined>.* | |
60 | \\\$tvar2\[\t \]+-92\[\t \]+<undefined>.* | |
61 | \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \ | |
62 | "List tvariables" | |
63 | ||
0914bcdb SS |
64 | gdb_test "print \$tvar2" " = void" \ |
65 | "Print a trace state variable before run" | |
66 | ||
e68d8fd4 | 67 | gdb_test_no_output "delete tvariable \$tvar2" \ |
f61e138d SS |
68 | "delete trace state variable" |
69 | ||
70 | gdb_test "info tvariables" \ | |
71 | "Name\[\t \]+Initial\[\t \]+Current.* | |
72 | \\\$tvar1\[\t \]+0\[\t \]+<undefined>.* | |
73 | \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \ | |
74 | "List tvariables after deletion" | |
75 | ||
0ab48859 MS |
76 | gdb_test "delete tvariable" \ |
77 | "" \ | |
78 | "Delete all trace state variables" \ | |
79 | "Delete all trace state variables.*y or n.*$" \ | |
80 | "y" | |
f61e138d SS |
81 | |
82 | gdb_test "info tvariables" \ | |
83 | "No trace state variables.*" \ | |
84 | "List tvariables after deleting all" | |
85 | ||
0914bcdb SS |
86 | # Now try running a trace. |
87 | ||
88 | runto_main | |
89 | gdb_reinitialize_dir $srcdir/$subdir | |
90 | ||
91 | # The rest of the testing needs actual tracing to work. | |
92 | if { ![gdb_target_supports_trace] } then { | |
10010058 | 93 | unsupported "Current target does not support trace" |
0914bcdb SS |
94 | return 1; |
95 | } | |
96 | ||
97 | # define relative source line numbers: | |
98 | # all subsequent line numbers are relative to this first one (baseline) | |
99 | ||
100 | set baseline [gdb_find_recursion_test_baseline $srcfile]; | |
101 | if { $baseline == -1 } then { | |
102 | fail "Could not find gdb_recursion_test function" | |
103 | return; | |
104 | } | |
105 | ||
106 | set testline1 [expr $baseline + 7] | |
107 | ||
108 | gdb_delete_tracepoints | |
109 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
110 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
111 | set trcpt3 [gdb_gettpnum $testline1]; | |
112 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
113 | fail "setting tracepoints" | |
114 | return; | |
115 | } | |
116 | ||
117 | gdb_test "tvariable \$tvar5 = 15" \ | |
118 | "Trace state variable \\\$tvar5 created, with initial value 15." \ | |
119 | "Create a trace state variable tvar5" | |
120 | ||
121 | gdb_trace_setactions "collect tsv for first tracepoint" \ | |
122 | "$trcpt1" \ | |
123 | "collect \$tvar5 += 1" "^$" | |
124 | ||
125 | gdb_test "tstart" ".*" "" | |
126 | ||
127 | gdb_test "print \$tvar5" " = 15" \ | |
128 | "Print a trace state variable at start of run" | |
129 | ||
130 | # Be sure not to fall off the end of the program. | |
131 | gdb_test "break end" ".*" "" | |
132 | gdb_test "continue" \ | |
133 | "Continuing.*Breakpoint $decimal, end.*" \ | |
134 | "run trace experiment" | |
135 | ||
136 | gdb_test "print \$tvar5" " = 16" \ | |
137 | "Print a trace state variable during run" | |
138 | ||
139 | gdb_test "tstop" ".*" "" | |
140 | ||
141 | gdb_test "print \$tvar5" " = 16" \ | |
142 | "Print a trace state variable after run" | |
143 | ||
f61e138d | 144 |