Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2009, 2010 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 | ||
18 | if $tracelevel then { | |
19 | strace $tracelevel | |
20 | } | |
21 | ||
f61e138d SS |
22 | |
23 | gdb_exit | |
24 | gdb_start | |
25 | set testfile "actions" | |
26 | set srcfile ${testfile}.c | |
27 | set binfile $objdir/$subdir/tsv | |
28 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
29 | executable {debug nowarnings}] != "" } { | |
30 | untested tracecmd.exp | |
31 | return -1 | |
32 | } | |
33 | gdb_reinitialize_dir $srcdir/$subdir | |
34 | ||
35 | # If testing on a remote host, download the source file. | |
36 | # remote_download host $srcdir/$subdir/$srcfile | |
37 | ||
38 | gdb_file_cmd $binfile | |
39 | ||
40 | gdb_test "tvariable \$tvar1" \ | |
41 | "Trace state variable \\\$tvar1 created, with initial value 0." \ | |
42 | "Create a trace state variable" | |
43 | ||
44 | gdb_test "tvariable \$tvar2 = 45" \ | |
45 | "Trace state variable \\\$tvar2 created, with initial value 45." \ | |
46 | "Create a trace state variable with initial value" | |
47 | ||
48 | gdb_test "tvariable \$tvar2 = -92" \ | |
49 | "Trace state variable \\\$tvar2 now has initial value -92." \ | |
50 | "Change initial value of a trace state variable" | |
51 | ||
52 | gdb_test "tvariable \$tvar3 = 2 + 3" \ | |
53 | "Trace state variable \\\$tvar3 created, with initial value 5." \ | |
54 | "Create a trace state variable with expression" | |
55 | ||
56 | gdb_test "tvariable \$tvar3 = 1234567000000" \ | |
57 | "Trace state variable \\\$tvar3 now has initial value 1234567000000." \ | |
58 | "Init trace state variable to a 64-bit value" | |
59 | ||
60 | gdb_test "tvariable main" \ | |
61 | "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \ | |
62 | "tvariable syntax error, bad name" | |
63 | ||
64 | gdb_test "tvariable \$tvar1 - 93" \ | |
65 | "Syntax must be \\\$NAME \\\[ = EXPR \\\]" \ | |
66 | "tvariable syntax error, not an assignment" | |
67 | ||
68 | gdb_test "info tvariables" \ | |
69 | "Name\[\t \]+Initial\[\t \]+Current.* | |
70 | \\\$tvar1\[\t \]+0\[\t \]+<undefined>.* | |
71 | \\\$tvar2\[\t \]+-92\[\t \]+<undefined>.* | |
72 | \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \ | |
73 | "List tvariables" | |
74 | ||
e68d8fd4 | 75 | gdb_test_no_output "delete tvariable \$tvar2" \ |
f61e138d SS |
76 | "delete trace state variable" |
77 | ||
78 | gdb_test "info tvariables" \ | |
79 | "Name\[\t \]+Initial\[\t \]+Current.* | |
80 | \\\$tvar1\[\t \]+0\[\t \]+<undefined>.* | |
81 | \\\$tvar3\[\t \]+1234567000000\[\t \]+.*<undefined>.*" \ | |
82 | "List tvariables after deletion" | |
83 | ||
0ab48859 MS |
84 | gdb_test "delete tvariable" \ |
85 | "" \ | |
86 | "Delete all trace state variables" \ | |
87 | "Delete all trace state variables.*y or n.*$" \ | |
88 | "y" | |
f61e138d SS |
89 | |
90 | gdb_test "info tvariables" \ | |
91 | "No trace state variables.*" \ | |
92 | "List tvariables after deleting all" | |
93 | ||
94 |