1 # Copyright
1998 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
}] != "" } {
43 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
46 gdb_reinitialize_dir $srcdir
/$subdir
48 #
If testing
on a remote host
, download the source file.
49 # remote_download host $srcdir
/$subdir
/$srcfile
53 #
define relative source line numbers
:
54 # all subsequent line numbers are relative to this first one
(baseline
)
56 set baseline
[gdb_find_recursion_test_baseline $srcfile
];
57 if { $baseline
== -1 } then {
58 fail
"Could not find gdb_recursion_test function"
62 set testline1
[expr $baseline
+ 7]
65 # test actions command
68 gdb_delete_tracepoints
69 set trcpt1
[gdb_gettpnum gdb_c_test
];
70 set trcpt2
[gdb_gettpnum gdb_asm_test
];
71 set trcpt3
[gdb_gettpnum $testline1
];
72 if { $trcpt1
<= 0 || $trcpt2
<= 0 || $trcpt3
<= 0 } then {
73 fail
"setting tracepoints"
77 #
5.1 actions of specified tracepoint
79 send_gdb
"info tracepoints\n"
81 -re
"Actions for tracepoint \[0-9\]+:.*$gdb_prompt $" {
82 fail
"5.1a: testsuite failure (tracepoint already has action)!"
84 -re
"No tracepoints.*$gdb_prompt $" {
85 fail
"5.1a: set three tracepoints, no actions (No tracepoints!)"
88 pass
"5.1a: set three tracepoints, no actions"
92 gdb_trace_setactions
"5.1b: set actions for first tracepoint" \
94 "collect gdb_char_test" "^$"
96 send_gdb
"info tracepoints\n"
98 -re
"Actions for.* $trcpt1:.*collect gdb_char_test.*$gdb_prompt $" {
99 pass
"5.1c: verify actions set for first tracepoint"
101 -re
"$gdb_prompt $" {
102 fail
"5.1c: verify actions set for first tracepoint"
106 gdb_trace_setactions
"5.1d: set actions for second tracepoint" \
108 "collect gdb_short_test" "^$"
110 send_gdb
"info tracepoints\n"
112 -re
"Actions for.* $trcpt2:.*collect gdb_short_test.*$gdb_prompt $" {
113 pass
"5.1e: verify actions set for second tracepoint"
115 -re
"$gdb_prompt $" {
116 fail
"5.1e: verify actions set for second tracepoint"
120 gdb_trace_setactions
"5.2a: set actions for last (default) tracepoint" \
122 "collect gdb_long_test" "^$"
124 send_gdb
"info tracepoints\n"
126 -re
"Actions for.* $trcpt3:.*collect gdb_long_test.*$gdb_prompt $" {
127 pass
"5.2b: verify actions set for last (default) tracepoint"
129 -re
"$gdb_prompt $" {
130 fail
"5.2b: verify actions set for last (default) tracepoint"
134 #
5.3 replace actions
set earlier
136 gdb_trace_setactions
"5.3a: reset actions for first tracepoint" \
138 "collect gdb_struct1_test" "^$"
140 send_gdb
"info tracepoints\n"
142 -re
"Actions for.* $trcpt1:.*collect gdb_struct1_test.*$gdb_prompt $" {
143 pass
"5.3b: verify actions set for first tracepoint"
145 -re
"$gdb_prompt $" {
146 fail
"5.3b: verify actions set for first tracepoint"
151 # test end command
(all by itself
)
154 #
5.4 end outside of
context
156 gdb_test
"end" "This command cannot be used at the top level." \
157 "5.4: 'end' command out of context"
159 #
5.5 empty actions
(just an end with no other actions
)
161 gdb_trace_setactions
"5.5a: set empty actions for first tracepoint" \
164 send_gdb
"info tracepoints\n"
166 -re
"No tracepoints.*$gdb_prompt $" {
167 fail
"5.5c: verify NO actions for first tracepoint"
169 -re
"Actions for.* $trcpt1:.*$gdb_prompt $" {
170 fail
"5.5c: verify NO actions for first tracepoint"
172 -re
"$gdb_prompt $" {
173 pass
"5.5c: verify NO actions for first tracepoint"
177 #
5.6 actions
for invalid tracepoint number
179 gdb_test
"actions [expr $trcpt2 + $trcpt3]" \
180 "No tracepoint number [expr $trcpt2 + $trcpt3]." \
181 "5.6: actions for invalid tracepoint number"
183 #
5.7 invalid action
(other than
'collect', 'while-stepping' or
'end')
184 #
"warning: .print gdb_c_test. is not a supported trace.*> $" \
186 gdb_trace_setactions
"5.7: invalid action" \
189 "warning: .print gdb_c_test. is not a supported trace"
191 #
5.8 help actions
(collect
, while-stepping
, end
)
193 gdb_test
"help actions" \
194 "Specify the actions to be taken at a tracepoint.*" \
197 gdb_test
"help collect" \
198 "Specify one or more data items to be collected at a tracepoint.*" \
201 gdb_test
"help while-stepping" \
202 "Specify single-stepping behavior at a tracepoint.*" \
203 "5.8c: help while-stepping"
205 gdb_test
"help end" "Ends a list of commands or actions.*" \