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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [config/] [vx.exp] - Blame information for rev 866

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

Line No. Rev Author Line
1 24 jeremybenn
#   Copyright 1988, 1990, 1991, 1992, 1995, 1997, 2007, 2008
2
#   Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
 
17
# This file was written by Rob Savoye. (rob@cygnus.com)
18
 
19
#
20
# load support libraries
21
#
22
load_lib remote.exp
23
load_lib gdb.exp
24
 
25
set shell_prompt "->"
26
set gdb_prompt "\\(vxgdb\\)"
27
 
28
#
29
# gdb_version -- extract and print the version number of gcc
30
#
31
proc gdb_version {} {
32
    default_gdb_version
33
}
34
 
35
#
36
# gdb_load -- load a file into the debugger.
37
# We have to stop and start gdb each time we do this, because when
38
# vxgdb loads two files in a row, the symbols in the first file loaded
39
# take precedence. Returns -1 on error, else 0.
40
#
41
proc gdb_load { arg } {
42
    set result 0
43
 
44
    if { [remote_ld target $arg] != 0 } {
45
        perror "Couldn't load $arg"
46
        return -1
47
    }
48
 
49
    return [gdb_file_cmd $arg]
50
}
51
 
52
#
53
# gdb_start -- start gdb running
54
#
55
proc gdb_start { } {
56
    global gdb_prompt
57
    global verbose
58
    global connectmode
59
    global reboot
60
 
61
    # get a connection to the board
62
    for { set x 0; } { $x < 3 } { incr x } {
63
        set shell_id [remote_open target]
64
        if { $shell_id > 0 } {
65
            verbose "Spawn id for remote shell is $shell_id"
66
 
67
            set timeout 10
68
            verbose "Timeout is now $timeout seconds" 2
69
 
70
            set state [spawn_vxgdb];
71
            if { $state == "pass" } {
72
                return 0;
73
            }
74
            if { $state == "fail" } {
75
                return -1;
76
            }
77
        }
78
        remote_reboot target;
79
    }
80
}
81
 
82
proc spawn_vxgdb { } {
83
    global gdb_prompt
84
 
85
    default_gdb_start
86
 
87
    # set the default arguments to "main", so that "run" with no
88
    # arguments will work correctly.
89
    send_gdb "set args main\n"
90
    gdb_expect -re ".*$gdb_prompt $" {}
91
 
92
    verbose "Setting up target, Please wait..."
93
    # set targets hostname
94
    send_gdb "target vxworks [target_info hostname]\n"
95
    set timeout 60
96
    verbose "Timeout is now $timeout seconds" 2
97
    gdb_expect {
98
        -re "Done\..*$gdb_prompt $"     {
99
            verbose "Set target to [target_info hostname]" 1
100
            set timeout 10;
101
            return "pass";
102
        }
103
        -re "net_connect: RPC: (Program not registered|.*Timed out).*$" {
104
            warning "Couldn't set GDB to target [target_info netport]."
105
        }
106
        timeout {
107
            warning "Couldn't set target for vxworks."
108
        }
109
    }
110
    return "retry";
111
}
112
 
113
proc gdb_exit { } {
114
    remote_close target;
115
    catch default_gdb_exit
116
}
117
 
118
#expect_after {
119
#    ""            { send "\n"; perror "Window too small." }
120
#    -re "\(y or n\) "     { send "n\n"; perror "Got interactive prompt." }
121
#    buffer_full                   { perror "internal buffer is full." }
122
#    eof                           { perror "eof -- pty is hosed." }
123
#    timeout                       { perror "timeout." }
124
#    "virtual memory exhausted" { perror "virtual memory exhausted." }
125
#    "Undefined command"           { perror "send string probably wrong." }
126
#}
127
 

powered by: WebSVN 2.1.0

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