Host/target/native split for sun4.
[deliverable/binutils-gdb.git] / gdb / remote-udi.c
index 68e8d37bb8f025dd56960d5187fc04bdccec0525..3f6dc788a80344cf8468d2a005c1024662824fba 100644 (file)
@@ -1,27 +1,13 @@
-/* 
- - Remote debugging interface for Am290*0 running MiniMON monitor, for GDB.
-   This is like remote.c but expects MiniMON to be running on the Am29000 
-   target hardware.
- - Originally written by Daniel Mann at AMD for gdb 3.91.6.
- - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this
-       file to gdb 3.95.  I was unable to get this working on sun3os4
-       with termio, only with sgtty.  Because we are only attempting to
-       use this module to debug our kernel, which is already loaded when
-       gdb is started up, I did not code up the file downloading facilities.  
-       As a result this module has only the stubs to download files. 
-       You should get tagged at compile time if you need to make any 
-       changes/additions.
-*- Daniel Mann at AMD took the 3.95 adaptions above and replaced
-       MiniMON interface with UDI-p interface.
-   Copyright (C) 1990 Free Software Foundation, Inc.
+/* Remote debugging interface for AMD 29k interfaced via UDI, for GDB.
+   Copyright 1990, 1992 Free Software Foundation, Inc.
+   Written by Daniel Mann.  Contributed by AMD.
 
 This file is part of GDB.
 
 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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 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
@@ -29,11 +15,27 @@ 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; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+/* This is like remote.c but uses the Universal Debug Interface (UDI) to 
+   talk to the target hardware (or simulator).  UDI is a TCP/IP based
+   protocol; for hardware that doesn't run TCP, an interface adapter 
+   daemon talks UDI on one side, and talks to the hardware (typically
+   over a serial port) on the other side.
 
-#include <stdio.h>
+ - Originally written by Daniel Mann at AMD for MiniMON and gdb 3.91.6.
+ - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this
+       file to gdb 3.95.  I was unable to get this working on sun3os4
+       with termio, only with sgtty.  Because we are only attempting to
+       use this module to debug our kernel, which is already loaded when
+       gdb is started up, I did not code up the file downloading facilities.  
+       As a result this module has only the stubs to download files. 
+       You should get tagged at compile time if you need to make any 
+       changes/additions.
+ - Daniel Mann at AMD took the 3.95 adaptions above and replaced
+       MiniMON interface with UDI-p interface.   */
 #include "defs.h"
 #include "inferior.h"
 #include "wait.h"
@@ -48,20 +50,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "29k-share/udi/udiproc.h"
 
 /* access the register store directly, without going through
-   the normal handler functions. This avoids an extra data copy
-*/
-
-/* #define DEBUG 1             /* */
-#ifdef DEBUG 
-# define DENTER(NAME)  (printf("Entering %s\n",NAME), fflush(stdout)) 
-# define DEXIT(NAME)   (printf("Exiting  %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)  
-# define DEXIT(NAME)   
-#endif 
+   the normal handler functions. This avoids an extra data copy.  */
 
-
-extern char register_valid[];
 extern int stop_soon_quietly;           /* for wait_for_inferior */
 extern struct value *call_function_by_hand();
 static void udi_resume();
@@ -168,7 +158,6 @@ udi_create_inferior (execfile, args, env)
      char *args;
      char **env;
 {
-  DENTER("udi_create_inferior()");
 
   if (execfile)
   { if (prog_name != NULL)
@@ -195,25 +184,16 @@ udi_create_inferior (execfile, args, env)
    udi_load(args, 0);
 #endif  /* !ULTRA3 */
 
-  /* We will get a task spawn event immediately.  */
-#ifdef NOTDEF          /* start_remote() now does a wait without a resume 
-                          so don't use it*/ 
-  start_remote ();
-#else
   init_wait_for_inferior ();
   clear_proceed_status ();
   proceed(-1,-1,0);
-#endif
-  DEXIT("udi_create_inferior()");
 }
 /******************************************************* UDI_MOURN_INFERIOR */
 static void
 udi_mourn()
 {
-  DENTER("udi_mourn()");
         pop_target ();                /* Pop back to no-child state */
         generic_mourn_inferior ();
-  DEXIT("udi_mourn()");
 }
 
 /******************************************************************** UDI_OPEN
@@ -241,8 +221,6 @@ udi_open (name, from_tty)
   UDIPId       PId;
   UDIUInt32    TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId;
 
-  DENTER("udi_open()");
-
   target_preopen(from_tty);
 
   /* Find the first whitespace character, it separates udi_config_id
@@ -378,7 +356,6 @@ udi_close (quitting)        /*FIXME: how is quitting used */
      int quitting;
 {
   int  Terminate = -1;
-  DENTER("udi_close()");
 
   if (udi_session_id < 0)
     error ("Can't close udi connection: not debugging remotely.");
@@ -401,8 +378,6 @@ udi_close (quitting)        /*FIXME: how is quitting used */
 #endif
 
   printf_filtered ("  Ending remote debugging\n");
-
-  DEXIT("udi_close()");
 } 
 
 /**************************************************************** UDI_ATACH */
@@ -420,23 +395,19 @@ udi_attach (args, from_tty)
   UDISizeT     Size = 4;
   UDICount     CountDone;
   UDIBool      HostEndian = 0;
-  DENTER("udi_attach()");
 
   if (udi_session_id < 0)
-      printf ("UDI connection not opened yet, use the 'target udi' command.\n");
+      error ("UDI connection not opened yet, use the 'target udi' command.\n");
        
   if (from_tty)
       printf ("Attaching to remote program %s...\n", prog_name);
 
-  mark_breakpoints_out ();
   UDIStop();
   From.Space = 11;
   From.Offset = UDI29KSpecialRegs;
   if(UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
     error ("UDIRead failed in udi_attach");
   printf ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
-
-  DEXIT("udi_attach()");
 }
 /************************************************************* UDI_DETACH */
 /* Terminate the open connection to the TIP process.
@@ -447,14 +418,12 @@ udi_detach (args,from_tty)
      char *args;
      int from_tty;
 {
-  DENTER("udi_dettach()");
   remove_breakpoints();                /* Just in case there were any left in */
   if(UDIDisconnect(udi_session_id))
     error ("UDIDisconnect() failed in udi_detach");
   pop_target();                /* calls udi_close to do the real work */
   if (from_tty)
     printf ("Ending remote debugging\n");
-  DEXIT("udi_dettach()");
 }
 
 
@@ -469,7 +438,7 @@ udi_resume (step, sig)
   UDIUInt32    Steps = 1;
   UDIStepType   StepType = UDIStepNatural;
   UDIRange      Range;
-  DENTER("udi_resume()");
+
   if (step)                    /* step 1 instruction */
   {  tip_error = tip_error = UDIStep(Steps, StepType, Range);
       if(tip_error)fprintf(stderr,  "UDIStep() error = %d\n", tip_error);
@@ -480,8 +449,6 @@ udi_resume (step, sig)
   { if(UDIExecute())
       error ("UDIExecute() failed in udi_resume");
   }
-
-  DEXIT("udi_resume()");
 }
 
 /******************************************************************** UDI_WAIT
@@ -500,7 +467,6 @@ udi_wait (status)
   int          old_immediate_quit = immediate_quit;
   int          i;
 
-  DENTER("udi_wait()");
   WSETEXIT ((*status), 0);
 
 /* wait for message to arrive. It should be:
@@ -618,7 +584,6 @@ exit:
 
   timeout = old_timeout;       /* Restore original timeout value */
   immediate_quit = old_immediate_quit;
-  DEXIT("udi_wait()");
   return 0;
 }
 
@@ -963,7 +928,6 @@ int     from_tty;
 {
        char    buf[4];
 
-       DENTER("udi_kill()");
 #if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
        /* We don't ever kill the kernel */
        if (from_tty) {
@@ -978,7 +942,6 @@ int     from_tty;
        }
        pop_target();
 #endif 
-       DEXIT("udi_kill()");
 }
 
 
@@ -1052,8 +1015,6 @@ udi_write_inferior_memory (memaddr, myaddr, len)
   UDICount     CountDone = 0;
   UDIBool      HostEndian = 0;
   
-
-  /* DENTER("udi_write_inferior_memory()"); */
   To.Space = udi_memory_space(memaddr);        
   From = (UDIUInt32*)myaddr;
 
@@ -1070,7 +1031,6 @@ udi_write_inferior_memory (memaddr, myaddr, len)
           From += CountDone;
        }
   }
-  /* DEXIT("udi_write_inferior_memory()"); */
   return(nwritten);
 }
 
@@ -1091,8 +1051,6 @@ udi_read_inferior_memory(memaddr, myaddr, len)
   UDICount     CountDone = 0;
   UDIBool      HostEndian = 0;
   
-
-  /* DENTER("udi_read_inferior_memory()"); */
   From.Space = udi_memory_space(memaddr);      
   To = (UDIUInt32*)myaddr;
 
@@ -1197,7 +1155,6 @@ store_register (regno)
   UDICount     CountDone;
   UDIBool      HostEndian = 0;
 
-  DENTER("store_register()");
   From =  read_register (regno);       /* get data value */
 
   if (regno == GR1_REGNUM)
@@ -1239,7 +1196,6 @@ store_register (regno)
     result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
   }
 
-  DEXIT("store_register()");
   if(result)
   { result = -1;
     error("UDIWrite() failed in store_registers");
@@ -1327,11 +1283,11 @@ int   QuietMode = 0;            /* used for debugging */
  */
 static struct target_ops udi_ops = {
         "udi", "Remote UDI connected TIP",
-       "Remote debug an Am290*0 using socket connection to TIP process ",
+       "Remote debug an AMD 29k using UDI socket connection to TIP process",
         udi_open, udi_close,
         udi_attach, udi_detach, udi_resume, udi_wait,
         udi_fetch_registers, udi_store_registers,
-        udi_prepare_to_store, 0, 0,   /* conv_to, conv_from */
+        udi_prepare_to_store,
         udi_xfer_inferior_memory,
         udi_files_info,
         udi_insert_breakpoint, udi_remove_breakpoint, /* Breakpoints */
@@ -1341,6 +1297,7 @@ static struct target_ops udi_ops = {
         0,                      /* lookup_symbol */
         udi_create_inferior,  /* create_inferior */
         udi_mourn,            /* mourn_inferior FIXME */
+       0,                      /* can_run */
         process_stratum, 0, /* next */
         1, 1, 1, 1, 1,  /* all mem, mem, stack, regs, exec */
        0, 0,                   /* Section pointers */
This page took 0.026882 seconds and 4 git commands to generate.