OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

Go to most recent revision | Details | Compare with Previous | View Log

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