2009-12-28 Stan Shebs <stan@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / tsv.exp
1 # Copyright 2009 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
16 load_lib "trace-support.exp";
17
18 if $tracelevel then {
19 strace $tracelevel
20 }
21
22 set prms_id 0
23 set bug_id 0
24
25 gdb_exit
26 gdb_start
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}] != "" } {
32 untested tracecmd.exp
33 return -1
34 }
35 gdb_reinitialize_dir $srcdir/$subdir
36
37 # If testing on a remote host, download the source file.
38 # remote_download host $srcdir/$subdir/$srcfile
39
40 gdb_file_cmd $binfile
41
42 gdb_test "tvariable \$tvar1" \
43 "Trace state variable \\\$tvar1 created, with initial value 0." \
44 "Create a trace state variable"
45
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"
49
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"
53
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"
57
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"
61
62 gdb_test "tvariable main" \
63 "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \
64 "tvariable syntax error, bad name"
65
66 gdb_test "tvariable \$tvar1 - 93" \
67 "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \
68 "tvariable syntax error, not an assignment"
69
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>.*" \
75 "List tvariables"
76
77 gdb_test "delete tvariable \$tvar2" \
78 "" \
79 "delete trace state variable"
80
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"
86
87 send_gdb "delete tvariable\n"
88 gdb_expect 30 {
89 -re "Delete all trace state variables.*y or n.*$" {
90 send_gdb "y\n"
91 gdb_expect 30 {
92 -re "$gdb_prompt $" {
93 pass "Delete all trace state variables"
94 }
95 timeout { fail "Delete all trace state variables (timeout)" }
96 }
97 }
98 -re "$gdb_prompt $" { # This happens if there were no variables
99 }
100 timeout { perror "Delete all trace state variables (timeout)" ; return }
101 }
102
103 gdb_test "info tvariables" \
104 "No trace state variables.*" \
105 "List tvariables after deleting all"
106
107
This page took 0.032459 seconds and 4 git commands to generate.