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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 106 markom
# Test Framework Driver for GDB using the extended gdb remote protocol
2
#   Copyright 1995, 1997 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 2 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, write to the Free Software
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
#
18
# For this to function correctly, you need to set a number of variables
19
# in your gdb/site.exp file
20
#
21
#       set noargs 1            -- we can't pass arguments (yet)
22
#       set noinferiorio 1      -- we can't get io to/from the inferior
23
#       set targethost  -- name of the remote system (runs gdbserver)
24
#       set debughost   -- name of the system running gdb
25
#       set port        -- starting port number for communication
26
#       set gdbserver   -- path (on the remote side) to find
27
#                                  gdbserver
28
#       set rsh                 -- path (on debughost side) to rsh
29
#       set rcp                 -- path (on debughost side) to rcp
30
#
31
# You will need to be able to spawn processes from gdbhost to run on
32
# targethost via rsh (this is how we start gdbserver); similarly
33
# you need to be able to rcp files from gdbhost to targethost.
34
#
35
# We don't do much error checking, if something goes wrong, you'll probably
36
# just get a tcl error and everything will die.  FIXME
37
#
38
 
39
# Load the basic gdb testing library
40
load_lib gdb.exp
41
load_lib monitor.exp
42
 
43
#
44
# gdb_load -- load a file into the debugger.
45
#             return a -1 if anything goes wrong.
46
#
47
# Loading a file in the gdbsrever framework is a little strange in that
48
# we also create the inferior (which is stopped at the first instruction
49
# in the program when we get control).
50
#
51
proc gdb_load { arg } {
52
    global verbose
53
    global loadpath
54
    global loadfile
55
    global GDB
56
    global gdb_prompt
57
    global debughost
58
    global port
59
 
60
    # bump the port number to avoid conflicts with hung ports
61
    set targethost [target_info gdb_server_host];
62
    set debughost [target_info gdb_debug_host];
63
    if [target_info exists gdb_server_prog] {
64
        set gdbserver [target_info gdb_server_prog];
65
    } else {
66
        set gdbserver "gdbserver";
67
    }
68
    incr port
69
    set serialport $targethost:$port
70
 
71
    # Copy the file down to the remote host.
72
    set file [remote_download host $arg];
73
 
74
    # now start gdbserver on the remote side
75
    remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
76
 
77
    # give it plenty of time to get going (lynx)
78
    sleep 30
79
 
80
    # tell gdb we are remote debugging
81
    if [gdb_target_monitor $arg] {
82
        return -1;
83
    }
84
 
85
    return 1
86
}
87
 
88
#
89
# gdb_start -- start GDB running.
90
#
91
proc gdb_start { } {
92
    global gdb_prompt
93
 
94
    # do the usual stuff
95
    catch default_gdb_start
96
 
97
    # FIXME: This shouldn't be necessary, but lots of PA tests fail
98
    # without it.
99
    send "set remotecache 0\n"
100
    expect {
101
        -re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
102
        default { fail "gdb_start"}
103
    }
104
}

powered by: WebSVN 2.1.0

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