OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.trace/] [save-trace.exp] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
#   Copyright 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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 .
15
 
16
# This file was written by Michael Snyder (msnyder@cygnus.com)
17
 
18
load_lib "trace-support.exp";
19
 
20
if $tracelevel then {
21
    strace $tracelevel
22
}
23
 
24
 
25
gdb_exit
26
gdb_start
27
 
28
set testfile "actions"
29
set srcfile ${testfile}.c
30
set binfile $objdir/$subdir/save-trace
31
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
32
          executable {debug nowarnings}] != "" } {
33
    untested save-trace.exp
34
    return -1
35
}
36
gdb_reinitialize_dir $srcdir/$subdir
37
 
38
# If testing on a remote host, download the source file.
39
# remote_download host $srcdir/$subdir/$srcfile
40
 
41
gdb_file_cmd $binfile
42
 
43
# define relative source line numbers:
44
# all subsequent line numbers are relative to this first one (baseline)
45
set baseline  [gdb_find_recursion_test_baseline $srcfile];
46
if { $baseline == -1 } then {
47
    fail "Could not find gdb_recursion_test function"
48
    return;
49
}
50
 
51
set testline1 [expr $baseline + 4]
52
set testline2 [expr $baseline + 5]
53
set testline3 [expr $baseline + 6]
54
set testline4 [expr $baseline + 7]
55
set testline5 [expr $baseline + 8]
56
set testline6 [expr $baseline + 9]
57
 
58
#
59
# test save-trace command
60
#
61
 
62
# setup a set of tracepoints to save
63
 
64
gdb_delete_tracepoints
65
 
66
foreach x { 1 2 3 4 5 6 } {
67
    set testline [expr \$testline$x];
68
    set trcpt [gdb_gettpnum $testline];
69
    set trcpt$x $trcpt;
70
    gdb_test "passcount $x" \
71
             "Setting tracepoint $trcpt.* to $x" \
72
             "10.x: set passcount for tracepoint $trcpt"
73
 
74
    gdb_test_no_output "condition $trcpt $x - 1 == $x / 2" \
75
             "10.x: set condition for tracepoint $trcpt"
76
 
77
    gdb_trace_setactions "10.x: set actions for tracepoint $x" \
78
            "" \
79
            "collect q$x" "^$" \
80
            "while-stepping $x" "^$" \
81
            "collect q$x" "^$" \
82
            "end" "^$"
83
}
84
 
85
gdb_test_no_output "set default-collect gdb_char_test, gdb_long_test - 100" \
86
    "10: set default-collect"
87
 
88
proc gdb_verify_tracepoints { testname } {
89
    global gdb_prompt;
90
 
91
    set ws "\[\t \]+"
92
    set nl "\[\r\n\]+"
93
    set ourstate 1;
94
    set result "pass";
95
    gdb_test_multiple "info tracepoints" "$testname" {
96
        -re "\[0-9\]+\[\t \]+tracepoint\[\t \]+keep y\[\t \]+0x\[0-9a-fA-F\]+ in gdb_recursion_test\[^\r\n\]+\r\n\[ \t]+trace only if \[0-9\] - 1 == \[0-9\] / 2" {
97
#           if { $expect_out(1,string) != $ourstate } {
98
#               set result "fail";
99
#           }
100
            incr ourstate;
101
            exp_continue;
102
        }
103
        -re "$gdb_prompt $" {
104
            if { $ourstate >= 6 } {
105
                set result "pass";
106
            } else {
107
                set result "fail";
108
            }
109
        }
110
        default {
111
            set result "fail";
112
        }
113
    }
114
    $result $testname;
115
 
116
    gdb_test "show default-collect" \
117
        "The list of expressions to collect by default is \"gdb_char_test, gdb_long_test - 100\"..*" \
118
        "10: show default-collect"
119
}
120
 
121
gdb_verify_tracepoints "10.x: verify trace setup";
122
 
123
# 10.1 Save current tracepoint definitions to a file
124
 
125
remote_file host delete savetrace.tr
126
gdb_test "save-tracepoints savetrace.tr" \
127
        "Saved to file 'savetrace.tr'." \
128
        "10.1: save tracepoint definitions"
129
 
130
# 10.2 Read back tracepoint definitions
131
 
132
gdb_delete_tracepoints
133
gdb_test_no_output "set default-collect" "10.2: clear default-collect"
134
gdb_test "info tracepoints" "No tracepoints." "10.2: delete tracepoints"
135
gdb_test "source savetrace.tr" \
136
        "Tracepoint \[0-9\]+ at .*" \
137
        "10.2: read back saved tracepoints"
138
gdb_verify_tracepoints "10.2: verify recovered tracepoints";
139
remote_file host delete savetrace.tr
140
 
141
# 10.3 repeat with a path to the file
142
 
143
set escapedfilename [string_to_regexp $objdir/savetrace.tr]
144
remote_file host delete $objdir/savetrace.tr
145
gdb_test "save-tracepoints $objdir/savetrace.tr" \
146
        "Saved to file '${escapedfilename}'." \
147
        "10.3: save tracepoint definitions, full path"
148
 
149
gdb_delete_tracepoints
150
gdb_test_no_output "set default-collect" "10.3: clear default-collect"
151
gdb_test "info tracepoints" "No tracepoints." "10.3: delete tracepoints"
152
gdb_test "source $objdir/savetrace.tr" \
153
        "Tracepoint \[0-9\]+ at .*" \
154
        "10.4: read saved tracepoints, full path"
155
gdb_verify_tracepoints "10.3: verify recovered tracepoints, full path";
156
remote_file host delete $objdir/savetrace.tr
157
 
158
# 10.5 invalid filename
159
#      [deferred -- not sure what a good invalid filename would be]
160
 
161
# 10.6 save-trace (file already exists)
162
#      [expect it to clobber the old one]
163
 
164
# 10.7 help save-tracepoints
165
 
166
gdb_test "help save-tracepoints" \
167
        "Save current tracepoint definitions as a script.*" \
168
        "10.7: help save-tracepoints"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.