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";
33 if [istarget
"m68k-*-elf"] then {
34 set srcfile gdb_c_test.c
35 set binfile
[board_info target d490_binfile
];
37 set testfile
"actions"
38 set srcfile $
{testfile
}.c
39 set binfile $objdir
/$subdir
/$testfile
40 if { [gdb_compile
"$srcdir/$subdir/$srcfile" $binfile \
41 executable
{debug nowarnings
}] != "" } {
42 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
45 gdb_reinitialize_dir $srcdir
/$subdir
47 #
If testing
on a remote host
, download the source file.
48 # remote_download host $srcdir
/$subdir
/$srcfile
52 #
define relative source line numbers
:
53 # all subsequent line numbers are relative to this first one
(baseline
)
54 set baseline
[gdb_find_recursion_test_baseline $srcfile
];
55 if { $baseline
== -1 } then {
56 fail
"Could not find gdb_recursion_test function"
60 set testline1
[expr $baseline
+ 3]
63 # test
"passcount" command
66 gdb_delete_tracepoints
67 set trcpt1
[gdb_gettpnum gdb_c_test
];
68 set trcpt2
[gdb_gettpnum gdb_asm_test
];
69 set trcpt3
[gdb_gettpnum $testline1
];
70 if { $trcpt1
<= 0 || $trcpt2
<= 0 || $trcpt3
<= 0 } then {
71 fail
"setting tracepoints"
75 #
4.1 passcount of specified tracepoint
77 gdb_test
"info tracepoints" \
78 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
79 "4.1a: set three tracepoints, passcounts all zero"
81 gdb_test
"passcount 2 $trcpt1" \
82 "Setting tracepoint $trcpt1.s passcount to 2" \
83 "4.1b: set 1st tracepoint's passcount to two"
85 gdb_test
"info tracepoints" \
86 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
87 "4.1c: verify 1st tracepoint's passcount set to two"
89 gdb_test
"passcount 4 $trcpt2" \
90 "Setting tracepoint $trcpt2.s passcount to 4" \
91 "4.1d: set 2nd tracepoint's passcount to four"
93 gdb_test
"info tracepoints" \
94 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
95 "4.1c: verify 2nd tracepoint's passcount set to four"
97 #
4.2 passcount of last
(default
) tracepoint
99 gdb_test
"passcount 6" \
100 "Setting tracepoint $trcpt3.s passcount to 6" \
101 "4.2b: set last (default) tp's passcount to six"
103 gdb_test
"info tracepoints" \
104 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+6\[\t \]+.*in gdb_recursion_test.*" \
105 "4.2b: verify last (default) tp's passcount set to six"
107 #
4.3 run until stopped explicitly by user
108 #
[deferred to dynamic test section
]
110 #
4.4 reset the previously
set passcounts to new
values
112 gdb_test
"passcount 7" \
113 "Setting tracepoint $trcpt3.s passcount to 7" \
114 "4.4a: reset last (default) tp's passcount to seven"
116 gdb_test
"info tracepoints" \
117 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \
118 "4.4a: verify reset last (default) tp's passcount to seven"
120 gdb_test
"passcount 5 $trcpt2" \
121 "Setting tracepoint $trcpt2.s passcount to 5" \
122 "4.4b: reset second tracepoint's passcount to five"
124 gdb_test
"info tracepoints" \
125 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+5\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \
126 "4.4c: verify reset second tracepoint's passcount to five"
128 #
4.20 <FIXME test number
> passcount
for "all"
130 gdb_test
"passcount 3 all" \
131 ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \
132 "4.20a: set all three passcounts to three"
134 gdb_test
"info tracepoints" \
135 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_recursion_test.*" \
136 "4.20a: set all three passcounts to three"
138 gdb_test
"passcount 4 all" \
139 ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \
140 "4.20a: reset all three passcounts to four"
142 gdb_test
"info tracepoints" \
143 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
144 "4.20b: reset all three passcounts to four"
146 #
4.5 Verify
trace stops
on first
"satisfied" passcount
147 #
[deferred to dynamic test section
]
149 #
4.6 minimum passcount boundary condition
151 gdb_test
"passcount 0 $trcpt1" \
152 "Setting tracepoint $trcpt1.s passcount to 0" \
153 "4.6: set passcount to zero"
155 gdb_test
"info tracepoints" \
156 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
157 "4.6: set passcount to zero"
159 #
4.7 (test a very large passcount
)
161 gdb_test
"passcount 32767 $trcpt1" \
162 "Setting tracepoint $trcpt1.s passcount to 32767" \
163 "4.7: set passcount to large number (32767)"
165 gdb_test
"info tracepoints" \
166 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+32767\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
167 "4.7: set passcount to large number (32767)"
169 #
4.8 set passcount
for invalid tracepoint
171 gdb_test
"passcount 1 [expr $trcpt2 + $trcpt3]" \
172 "No tracepoint number [expr $trcpt2 + $trcpt3]." \
173 "4.8: invalid tracepoint number in passcount"
176 gdb_test
"help passcount" "Set the passcount for a tracepoint.*" \
177 "4.9: help passcount"