Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / config / gdbserver.exp
index e4dabca537db9d630707d81521fb274837d4ec37..211f88d2476b160f333895d1b4c3b35c97ea620e 100644 (file)
@@ -1,36 +1,28 @@
-# Test framework for GDB (remote protocol) using a "gdbserver",
-# ie. a debug agent running as a native process on the same or
-# a different host.
-
-#   Copyright 2000 Free Software Foundation, Inc.
+# Copyright 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+# Free Software Foundation, Inc.
 
 # 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# This file was written by Michael Snyder. (msnyder@redhat.com)
+# Test framework for GDB (remote protocol) using a "gdbserver",
+# ie. a debug agent running as a native process on the same or
+# a different host.
 
 #
 # This module to be used for testing gdb with a "gdbserver" 
 # built either from libremote or from gdb/gdbserver.  
 #
 
-# Load the basic testing library, and the remote stuff.
-load_lib ../config/monitor.exp
-
 #
 # To be addressed or set in your baseboard config file:
 #
@@ -73,102 +65,23 @@ load_lib ../config/monitor.exp
 #      Defaults to "localhost".  Note: old gdbserver requires 
 #      that you define this, but libremote/gdbserver does not.
 #
-#   set_board_info socketport
+#   set_board_info gdb,socketport
 #      Port id to use for socket connection.  If not set explicitly,
 #      it will start at "2345" and increment for each use.
 #
 
+# The guts live in gdbserver-support.exp now.
 
+load_lib gdbserver-support.exp
 
-#
-# gdb_load -- load a file into the debugger.
-#             return a -1 if anything goes wrong.
-#
-
-global server_exec;
-global portnum;
-set portnum "2345";
-
-proc gdb_load { args } {
-    global server_exec;
-    global portnum;
-
-    # Port id -- either specified in baseboard file, or managed here.
-    if [target_info exists gdb,socketport] {
-       set portnum [target_info gdb,socketport];
-    } else {
-       # Bump the port number to avoid conflicts with hung ports.
-       incr portnum;
-    }
-
-    # Extract the local and remote host ids from the target board struct.
-
-    if [target_info exists sockethost] {
-       set debughost  [target_info sockethost];
-    } else {
-       set debughost "localhost:";
-    }
-    # Extract the protocol
-    if [target_info exists gdb_protocol] {
-       set protocol [target_info gdb_protocol];
-    } else {
-       set protocol "remote";
-    }
-
-    # Extract the name of the gdbserver, if known (default 'gdbserver').
-    if [target_info exists gdb_server_prog] {
-       set gdbserver [target_info gdb_server_prog];
-    } else {
-       set gdbserver "gdbserver";
-    }
-    # Extract the socket hostname
-    if [target_info exists sockethost] {
-       set sockethost [target_info sockethost];
-    } else {
-       set sockethost ""
-    }
-
-    # Export the host:port pair.
-    set gdbport $debughost$portnum;
-
-    if { $args == "" || $args == "{}" } {
-       if [info exists server_exec] {
-           set args $server_exec;
-       } else {
-           send_gdb "info files\n";
-           gdb_expect 30 {
-               -re "Symbols from \"(\[^\"\]+)\"" {
-                   set args $expect_out(1,string);
-                   exp_continue;
-               }
-               -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
-                   set args $expect_out(1,string);
-                   exp_continue;
-               }
-               -re "$gdb_prompt $" { }
-           }
-       }
-    }
-
-    # remember new exec file 
-    set server_exec $args;
-
-    # Fire off the debug agent
-    remote_spawn host \
-           "$gdbserver $sockethost$portnum $args >& /dev/null < /dev/null &" \
-           writeonly 
-    
-    # Give it a little time to establish
-    sleep 2
-
-    # tell gdb what file we are debugging
-    if [gdb_file_cmd $args] {
-       return -1;
-    }
-
-    # attach to the "serial port"
-    gdb_target_cmd $protocol $gdbport;
+proc gdbserver_gdb_load { } {
+    return [gdbserver_spawn ""]
+}
 
-    return 0;
+proc gdb_reload { } {
+    return [gdbserver_run ""]
 }
 
+proc gdb_reconnect { } {
+    return [gdbserver_reconnect]
+}
This page took 0.02686 seconds and 4 git commands to generate.