1 # Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>.
16 load_lib "trace-support.exp";
27 set testfile "actions"
28 set srcfile ${testfile}.c
29 set binfile $objdir/$subdir/tsv
30 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
31 executable {debug nowarnings}] != "" } {
35 gdb_reinitialize_dir $srcdir/$subdir
37 # If testing on a remote host, download the source file.
38 # remote_download host $srcdir/$subdir/$srcfile
42 gdb_test "tvariable \$tvar1" \
43 "Trace state variable \\\$tvar1 created, with initial value 0." \
44 "Create a trace state variable"
46 gdb_test "tvariable \$tvar2 = 45" \
47 "Trace state variable \\\$tvar2 created, with initial value 45." \
48 "Create a trace state variable with initial value"
50 gdb_test "tvariable \$tvar2 = -92" \
51 "Trace state variable \\\$tvar2 now has initial value -92." \
52 "Change initial value of a trace state variable"
54 gdb_test "tvariable \$tvar3 = 2 + 3" \
55 "Trace state variable \\\$tvar3 created, with initial value 5." \
56 "Create a trace state variable with expression"
58 gdb_test "tvariable \$tvar3 = 1234567000000" \
59 "Trace state variable \\\$tvar3 now has initial value 1234567000000." \
60 "Init trace state variable to a 64-bit value"
62 gdb_test "tvariable main" \
63 "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \
64 "tvariable syntax error, bad name"
66 gdb_test "tvariable \$tvar1 - 93" \
67 "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \
68 "tvariable syntax error, not an assignment"
70 gdb_test "info tvariables" \
71 "Name\[\t \]+Initial\[\t \]+Current.*
72 \\\$tvar1\[\t \]+0\[\t \]+<undefined>.*
73 \\\$tvar2\[\t \]+-92\[\t \]+<undefined>.*
74 \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \
77 gdb_test "delete tvariable \$tvar2" \
79 "delete trace state variable"
81 gdb_test "info tvariables" \
82 "Name\[\t \]+Initial\[\t \]+Current.*
83 \\\$tvar1\[\t \]+0\[\t \]+<undefined>.*
84 \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \
85 "List tvariables after deletion"
87 send_gdb "delete tvariable\n"
89 -re "Delete all trace state variables.*y or n.*$" {
93 pass "Delete all trace state variables"
95 timeout { fail "Delete all trace state variables (timeout)" }
98 -re "$gdb_prompt $" { # This happens if there were no variables
100 timeout { perror "Delete all trace state variables (timeout)" ; return }
103 gdb_test "info tvariables" \
104 "No trace state variables.*" \
105 "List tvariables after deleting all"