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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [config/] [gdbserver.exp] - Diff between revs 107 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
# Test Framework Driver for GDB using the extended gdb remote protocol
# Test Framework Driver for GDB using the extended gdb remote protocol
#   Copyright 1995, 1997 Free Software Foundation, Inc.
#   Copyright 1995, 1997 Free Software Foundation, Inc.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# For this to function correctly, you need to set a number of variables
# For this to function correctly, you need to set a number of variables
# in your gdb/site.exp file
# in your gdb/site.exp file
#
#
#       set noargs 1            -- we can't pass arguments (yet)
#       set noargs 1            -- we can't pass arguments (yet)
#       set noinferiorio 1      -- we can't get io to/from the inferior
#       set noinferiorio 1      -- we can't get io to/from the inferior
#       set targethost  -- name of the remote system (runs gdbserver)
#       set targethost  -- name of the remote system (runs gdbserver)
#       set debughost   -- name of the system running gdb
#       set debughost   -- name of the system running gdb
#       set port        -- starting port number for communication
#       set port        -- starting port number for communication
#       set gdbserver   -- path (on the remote side) to find
#       set gdbserver   -- path (on the remote side) to find
#                                  gdbserver
#                                  gdbserver
#       set rsh                 -- path (on debughost side) to rsh
#       set rsh                 -- path (on debughost side) to rsh
#       set rcp                 -- path (on debughost side) to rcp
#       set rcp                 -- path (on debughost side) to rcp
#
#
# You will need to be able to spawn processes from gdbhost to run on
# You will need to be able to spawn processes from gdbhost to run on
# targethost via rsh (this is how we start gdbserver); similarly
# targethost via rsh (this is how we start gdbserver); similarly
# you need to be able to rcp files from gdbhost to targethost.
# you need to be able to rcp files from gdbhost to targethost.
#
#
# We don't do much error checking, if something goes wrong, you'll probably
# We don't do much error checking, if something goes wrong, you'll probably
# just get a tcl error and everything will die.  FIXME
# just get a tcl error and everything will die.  FIXME
#
#
# Load the basic gdb testing library
# Load the basic gdb testing library
load_lib gdb.exp
load_lib gdb.exp
load_lib monitor.exp
load_lib monitor.exp
#
#
# gdb_load -- load a file into the debugger.
# gdb_load -- load a file into the debugger.
#             return a -1 if anything goes wrong.
#             return a -1 if anything goes wrong.
#
#
# Loading a file in the gdbsrever framework is a little strange in that
# Loading a file in the gdbsrever framework is a little strange in that
# we also create the inferior (which is stopped at the first instruction
# we also create the inferior (which is stopped at the first instruction
# in the program when we get control).
# in the program when we get control).
#
#
proc gdb_load { arg } {
proc gdb_load { arg } {
    global verbose
    global verbose
    global loadpath
    global loadpath
    global loadfile
    global loadfile
    global GDB
    global GDB
    global gdb_prompt
    global gdb_prompt
    global debughost
    global debughost
    global port
    global port
    # bump the port number to avoid conflicts with hung ports
    # bump the port number to avoid conflicts with hung ports
    set targethost [target_info gdb_server_host];
    set targethost [target_info gdb_server_host];
    set debughost [target_info gdb_debug_host];
    set debughost [target_info gdb_debug_host];
    if [target_info exists gdb_server_prog] {
    if [target_info exists gdb_server_prog] {
        set gdbserver [target_info gdb_server_prog];
        set gdbserver [target_info gdb_server_prog];
    } else {
    } else {
        set gdbserver "gdbserver";
        set gdbserver "gdbserver";
    }
    }
    incr port
    incr port
    set serialport $targethost:$port
    set serialport $targethost:$port
    # Copy the file down to the remote host.
    # Copy the file down to the remote host.
    set file [remote_download host $arg];
    set file [remote_download host $arg];
    # now start gdbserver on the remote side
    # now start gdbserver on the remote side
    remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
    remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
    # give it plenty of time to get going (lynx)
    # give it plenty of time to get going (lynx)
    sleep 30
    sleep 30
    # tell gdb we are remote debugging
    # tell gdb we are remote debugging
    if [gdb_target_monitor $arg] {
    if [gdb_target_monitor $arg] {
        return -1;
        return -1;
    }
    }
    return 1
    return 1
}
}
#
#
# gdb_start -- start GDB running.
# gdb_start -- start GDB running.
#
#
proc gdb_start { } {
proc gdb_start { } {
    global gdb_prompt
    global gdb_prompt
    # do the usual stuff
    # do the usual stuff
    catch default_gdb_start
    catch default_gdb_start
    # FIXME: This shouldn't be necessary, but lots of PA tests fail
    # FIXME: This shouldn't be necessary, but lots of PA tests fail
    # without it.
    # without it.
    send "set remotecache 0\n"
    send "set remotecache 0\n"
    expect {
    expect {
        -re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
        -re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
        default { fail "gdb_start"}
        default { fail "gdb_start"}
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

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