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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [config/] [slite.exp] - Blame information for rev 106

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

Line No. Rev Author Line
1 106 markom
#   Copyright (C) 1993, 1997, 1998 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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# DejaGnu@cygnus.com
19
 
20
# This file was written by Ian Lance Taylor .
21
 
22
# GDB support routines for a board using the MIPS remote debugging
23
# protocol.  These are actually pretty generic.
24
 
25
# DejaGnu currently assumes that debugging is being done over the main
26
# console port.  It would probably be more convenient for people using
27
# IDT boards to permit the debugging port and the connected port to be
28
# different, since an IDT board has two ports.  This would require
29
# extending some of the tests in a fashion similar to that done for
30
# VxWorks, because the test output would appear on the other port,
31
# rather than being displayed by gdb.
32
 
33
load_lib remote.exp
34
load_lib gdb.exp
35
set gdb_prompt "\\(gdb\\)"
36
 
37
#
38
# gdb_load -- load a file into the GDB.
39
#             Returns a 0 if there was an error,
40
#                       1 if it load successfully.
41
#
42
proc gdb_load { arg } {
43
    global verbose
44
    global loadpath
45
    global loadfile
46
    global gdb_prompt
47
    global GDB
48
    global expect_out
49
 
50
    set loadfile [file tail $arg]
51
    set loadpath [file dirname $arg]
52
 
53
    gdb_file_cmd $arg
54
 
55
    if [target_info exists gdb_protocol] {
56
        set protocol [target_info gdb_protocol];
57
    } else {
58
        set protocol "sparclite"
59
    }
60
 
61
    if [target_info exists serial] {
62
        set targetname [target_info serial];
63
        set command "target $protocol [target_info serial]\n";
64
    } else {
65
        if ![target_info exists netport] {
66
            perror "Need either netport or gdb_serial entry for [target_info name].";
67
            return -1;
68
        }
69
        set targetname [target_info netport];
70
        set command "target $protocol udp [target_info netport]\n";
71
    }
72
    set timeout 60
73
    verbose "Timeout is now $timeout seconds" 2
74
    set try_count 0;
75
    send_gdb $command;
76
    gdb_expect {
77
         -re "Unknown response.*resetting the board.|remote timeout" {
78
            incr try_count;
79
            if { $try_count > 3 } {
80
                set try_count 0;
81
                reboot_target;
82
                sleep 5;
83
            }
84
            sleep 1;
85
            send_gdb $command;
86
            exp_continue;
87
        }
88
         -re "Remote target.*$gdb_prompt $" { }
89
         -re ".*SPARClite appears to be alive.*$gdb_prompt $"   {
90
            if $verbose>1 then {
91
                send_user "Set target to $targetname\n"
92
            }
93
        }
94
         timeout {
95
            perror "Couldn't set SLITE target."
96
            set timeout 10
97
            verbose "Timeout is now $timeout seconds" 2
98
            return -1
99
        }
100
    }
101
 
102
    if [target_info exists gdb_load_offset] {
103
        set offset "[target_info gdb_load_offset]";
104
    } else {
105
        set offset "";
106
    }
107
    if { 1 } {
108
        if [is_remote host] {
109
            set arg [remote_download host $arg];
110
            if { $arg == "" } {
111
                error "download failed"
112
                return -1;
113
            }
114
        }
115
        send_gdb "load $arg $offset\n"
116
        verbose "Loading $arg into $GDB" 2
117
        set timeout 2400
118
        verbose "Timeout is now $timeout seconds" 2
119
        gdb_expect {
120
             -re "Loading.*$gdb_prompt $" {
121
                verbose "Loaded $arg into $GDB" 1
122
                set timeout 30
123
                verbose "Timeout is now $timeout seconds" 2
124
            }
125
             -re "$gdb_prompt $"     {
126
                if $verbose>1 then {
127
                    perror "GDB couldn't load."
128
                }
129
            }
130
             timeout {
131
                if $verbose>1 then {
132
                    perror "Timed out trying to load $arg."
133
                }
134
            }
135
        }
136
    }
137
    # Some SPARClite boards automagically do a run after the program is
138
    # loaded.
139
    if [target_info exists need_monitor_run] {
140
        set timeout 10
141
        verbose "Timeout is now $timeout seconds, doing monitor run" 2
142
        send_gdb "monitor run\n";
143
        sleep 2;
144
        send_gdb "";
145
        gdb_expect {
146
             -re ".*$gdb_prompt $" { verbose "Run command succeded" }
147
             default {
148
                perror "error sending monitor run command";
149
            }
150
        }
151
    } else {
152
        sleep 2;
153
    }
154
 
155
    if [target_info exists gdb_serial] {
156
        set serial [target_info gdb_serial];
157
    } else {
158
        set serial [target_info serial];
159
    }
160
    send_gdb "target remote $serial\n"
161
    set timeout 60
162
    verbose "Timeout is now $timeout seconds" 2
163
    gdb_expect {
164
         -re ".*Kill it?.*y or n.*" {
165
            send_gdb "y\n";
166
            exp_continue
167
        }
168
         -re ".*$gdb_prompt $"  {
169
            verbose "Set remote target to [target_info serial]" 2
170
        }
171
         timeout {
172
            perror "Couldn't set remote target."
173
            set timeout 10
174
            verbose "Timeout is now $timeout seconds" 2
175
            return -1
176
        }
177
    }
178
 
179
    if [info exists expect_out(buffer)] then {
180
        send_log $expect_out(buffer)
181
    }
182
    return 0
183
}

powered by: WebSVN 2.1.0

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