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