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 srcfile gdb_c_test.c
36 set binfile
[board_info target d490_binfile
];
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
)
55 set baseline
[gdb_find_recursion_test_baseline $srcfile
];
56 if { $baseline
== -1 } then {
57 fail
"Could not find gdb_recursion_test function"
61 set testline1
[expr $baseline
+ 4]
62 set testline2
[expr $baseline
+ 5]
63 set testline3
[expr $baseline
+ 6]
64 set testline4
[expr $baseline
+ 7]
65 set testline5
[expr $baseline
+ 8]
66 set testline6
[expr $baseline
+ 9]
69 # test save
-trace command
72 # setup a
set of tracepoints to save
74 gdb_delete_tracepoints
76 foreach x
{ 1 2 3 4 5 6 } {
77 set testline
[expr \$testline$x
];
78 set trcpt
[gdb_gettpnum $testline
];
80 gdb_test
"passcount $x" \
81 "Setting tracepoint $trcpt.* to $x" \
82 "10.x: set passcount for tracepoint $trcpt"
84 gdb_trace_setactions
"10.x: set actions for tracepoint $x" \
87 "while-stepping $x" "^$" \
93 proc gdb_verify_tracepoints
{ testname
} {
100 send_gdb
"info tracepoints\n";
102 -re
"y\[\t \]+0x\[0-9a-fA-F\]+\[\t \]+(\[0-9\]+)\[\t \]+(\[0-9\]+)\[\t \]+in gdb_recursion_test\[^\r\n\]+" {
103 if { $expect_out
(1,string
) != $expect_out
(2,string
) } {
106 if { $expect_out
(1,string
) != $ourstate
} {
112 -re
"$gdb_prompt $" {
113 if { $ourstate
>= 6 } {
127 gdb_verify_tracepoints
"10.x: verify trace setup";
129 #
10.1 Save current tracepoint definitions to a file
131 remote_file host
delete savetrace.tr
132 gdb_test
"save-tracepoints savetrace.tr" \
133 "Tracepoints saved to file 'savetrace.tr'." \
134 "10.1: save tracepoint definitions"
136 #
10.2 Read
back tracepoint definitions
138 gdb_delete_tracepoints
139 gdb_test
"info tracepoints" "No tracepoints." "10.2: delete tracepoints"
140 gdb_test
"source savetrace.tr" \
141 "Tracepoint \[0-9\]+ at .*" \
142 "10.2: read back saved tracepoints"
143 gdb_verify_tracepoints
"10.2: verify recovered tracepoints";
144 remote_file host
delete savetrace.tr
146 #
10.3 repeat with a path to the file
148 set escapedfilename
[string_to_regexp $objdir
/savetrace.tr
]
149 remote_file host
delete $objdir
/savetrace.tr
150 gdb_test
"save-tracepoints $objdir/savetrace.tr" \
151 "Tracepoints saved to file '${escapedfilename}'." \
152 "10.3: save tracepoint definitions, full path"
154 gdb_delete_tracepoints
155 gdb_test
"info tracepoints" "No tracepoints." "10.3: delete tracepoints"
156 gdb_test
"source $objdir/savetrace.tr" \
157 "Tracepoint \[0-9\]+ at .*" \
158 "10.4: read saved tracepoints, full path"
159 gdb_verify_tracepoints
"10.3: verify recovered tracepoints, full path";
160 remote_file host
delete $objdir
/savetrace.tr
162 #
10.5 invalid filename
163 #
[deferred
-- not sure what a good invalid filename would be
]
165 #
10.6 save
-trace (file already
exists)
166 #
[expect it to clobber the old one
]
168 #
10.7 help save
-tracepoints
170 gdb_test
"help save-tracepoints" \
171 "Save current tracepoint definitions as a script.*" \
172 "10.7: help save-tracepoints"