1 # Copyright 1998, 2007 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Michael Snyder (msnyder@cygnus.com)
22 load_lib "trace-support.exp";
34 if [istarget "m68k-*-elf"] then {
35 set binfile [board_info target d490_binfile];
36 set srcfile gdb_c_test.c
38 set testfile "actions"
39 set srcfile ${testfile}.c
40 set binfile $objdir/$subdir/$testfile
41 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
42 executable {debug nowarnings}] != "" } {
47 gdb_reinitialize_dir $srcdir/$subdir
49 # If testing on a remote host, download the source file.
50 # remote_download host $srcdir/$subdir/$srcfile
54 # define relative source line numbers:
55 # all subsequent line numbers are relative to this first one (baseline)
57 set baseline [gdb_find_recursion_test_baseline $srcfile];
58 if { $baseline == -1 } then {
59 fail "Could not find gdb_recursion_test function"
63 set testline1 [expr $baseline + 7]
66 # test actions command
69 gdb_delete_tracepoints
70 set trcpt1 [gdb_gettpnum gdb_c_test];
71 set trcpt2 [gdb_gettpnum gdb_asm_test];
72 set trcpt3 [gdb_gettpnum $testline1];
73 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
74 fail "setting tracepoints"
78 # 5.1 actions of specified tracepoint
80 send_gdb "info tracepoints\n"
82 -re "Actions for tracepoint \[0-9\]+:.*$gdb_prompt $" {
83 fail "5.1a: testsuite failure (tracepoint already has action)!"
85 -re "No tracepoints.*$gdb_prompt $" {
86 fail "5.1a: set three tracepoints, no actions (No tracepoints!)"
89 pass "5.1a: set three tracepoints, no actions"
93 gdb_trace_setactions "5.1b: set actions for first tracepoint" \
95 "collect gdb_char_test" "^$"
97 send_gdb "info tracepoints\n"
99 -re "Actions for.* $trcpt1:.*collect gdb_char_test.*$gdb_prompt $" {
100 pass "5.1c: verify actions set for first tracepoint"
102 -re "$gdb_prompt $" {
103 fail "5.1c: verify actions set for first tracepoint"
107 gdb_trace_setactions "5.1d: set actions for second tracepoint" \
109 "collect gdb_short_test" "^$"
111 send_gdb "info tracepoints\n"
113 -re "Actions for.* $trcpt2:.*collect gdb_short_test.*$gdb_prompt $" {
114 pass "5.1e: verify actions set for second tracepoint"
116 -re "$gdb_prompt $" {
117 fail "5.1e: verify actions set for second tracepoint"
121 gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \
123 "collect gdb_long_test" "^$"
125 send_gdb "info tracepoints\n"
127 -re "Actions for.* $trcpt3:.*collect gdb_long_test.*$gdb_prompt $" {
128 pass "5.2b: verify actions set for last (default) tracepoint"
130 -re "$gdb_prompt $" {
131 fail "5.2b: verify actions set for last (default) tracepoint"
135 # 5.3 replace actions set earlier
137 gdb_trace_setactions "5.3a: reset actions for first tracepoint" \
139 "collect gdb_struct1_test" "^$"
141 send_gdb "info tracepoints\n"
143 -re "Actions for.* $trcpt1:.*collect gdb_struct1_test.*$gdb_prompt $" {
144 pass "5.3b: verify actions set for first tracepoint"
146 -re "$gdb_prompt $" {
147 fail "5.3b: verify actions set for first tracepoint"
152 # test end command (all by itself)
155 # 5.4 end outside of context
157 gdb_test "end" "This command cannot be used at the top level." \
158 "5.4: 'end' command out of context"
160 # 5.5 empty actions (just an end with no other actions)
162 gdb_trace_setactions "5.5a: set empty actions for first tracepoint" \
165 send_gdb "info tracepoints\n"
167 -re "No tracepoints.*$gdb_prompt $" {
168 fail "5.5c: verify NO actions for first tracepoint"
170 -re "Actions for.* $trcpt1:.*$gdb_prompt $" {
171 fail "5.5c: verify NO actions for first tracepoint"
173 -re "$gdb_prompt $" {
174 pass "5.5c: verify NO actions for first tracepoint"
178 # 5.6 actions for invalid tracepoint number
180 gdb_test "actions [expr $trcpt2 + $trcpt3]" \
181 "No tracepoint number [expr $trcpt2 + $trcpt3]." \
182 "5.6: actions for invalid tracepoint number"
184 # 5.7 invalid action (other than 'collect', 'while-stepping' or 'end')
185 # "warning: .print gdb_c_test. is not a supported trace.*> $" \
187 gdb_trace_setactions "5.7: invalid action" \
190 "warning: .print gdb_c_test. is not a supported trace"
192 # 5.8 help actions (collect, while-stepping, end)
194 gdb_test "help actions" \
195 "Specify the actions to be taken at a tracepoint.*" \
198 gdb_test "help collect" \
199 "Specify one or more data items to be collected at a tracepoint.*" \
202 gdb_test "help while-stepping" \
203 "Specify single-stepping behavior at a tracepoint.*" \
204 "5.8c: help while-stepping"
206 gdb_test "help end" "Ends a list of commands or actions.*" \