1999-01-19 Fernando Nasser <fnasser@totem.to.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / remote-es.c
index f61c1eb3db0d6c7760b3f228592fed75b3124008..d26e85b7890b0ae4bcab0cb092adc9150615a4eb 100644 (file)
@@ -20,8 +20,8 @@ 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 GDB; 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
 /* Emulator communication protocol.
@@ -96,27 +96,18 @@ STP
 #include <sys/file.h>
 #include <errno.h>
 #include <ctype.h>
-#include <string.h>
 #include <setjmp.h>
 #include <fcntl.h>
 #include "defs.h"
+#include "gdb_string.h"
 #include "frame.h"
 #include "inferior.h"
 #include "target.h"
 #include "wait.h"
-#include "terminal.h"
 #include "command.h"
-
-#ifdef USG
-#include <sys/types.h>
-#include <sgtty.h>
-#endif
-
-#include <signal.h>
-
-/* External variables referenced. */
-
-extern bfd *exec_bfd;
+#include "remote-utils.h"
+#include "gdbcore.h"
+#include "serial.h"
 
 /* Prototypes for local functions */
 
@@ -157,11 +148,9 @@ es1800_xfer_inferior_memory PARAMS ((CORE_ADDR, char *, int, int,
 static void 
 es1800_prepare_to_store PARAMS ((void));
 
-static int
-es1800_wait PARAMS ((WAITTYPE *));
+static int es1800_wait PARAMS ((int, struct target_waitstatus *));
 
-static void
-es1800_resume PARAMS ((int, int, int));
+static void es1800_resume PARAMS ((int, int, enum target_signal));
 
 static void
 es1800_detach PARAMS ((char *, int));
@@ -251,6 +240,7 @@ es1800_init_break PARAMS ((char *, int));
 
 /* Local variables */
 
+/* FIXME: Convert this to use "set remotedebug" instead.  */
 #define LOG_FILE "es1800.log"
 #if defined (LOG_FILE)
 static FILE *log_file;
@@ -262,7 +252,7 @@ extern struct target_ops es1800_child_ops;  /* Forward decl */
 static int kiodebug;
 static int timeout = 100; 
 static char *savename;                         /* Name of i/o device used */
-static TERMINAL es1800_sg_save;                        /* Save stty state */
+static serial_ttystate es1800_saved_ttystate;
 static int es1800_fc_save;                     /* Save fcntl state */
 
 /* indicates that the emulator uses 32-bit data-adress (68020-mode) 
@@ -273,11 +263,11 @@ static int m68020;
 #define MODE (m68020 ? "M68020" : "M68000" )
 #define ES1800_BREAK_VEC (0xf)
 
-/* Descriptor for I/O to remote machine.  Initialize it to -1 so that
+/* Descriptor for I/O to remote machine.  Initialize it to NULL so that
    es1800_open knows that we don't have a file open when the program
    starts.  */
 
-static int es1800_desc = -1;
+static serial_t es1800_desc = NULL;
 
 #define        PBUFSIZ 1000
 #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
@@ -329,24 +319,6 @@ es1800_reset (quit)
 }
 
 
-/* Called when SIGALRM signal sent due to alarm() timeout.
-   Rely on global variables: timeout  */
-
-#ifndef HAVE_TERMIO
-
-static void
-es1800_timer ()
-{
-  if (kiodebug)
-    {
-      printf ("es1800_timer called\n");
-    }
-  alarm (timeout);
-}
-
-#endif /* HAVE_TERMIO */
-
-
 /* Open a connection to a remote debugger and push the new target
    onto the stack. Check if the emulator is responding and find out
    what kind of processor the emulator is connected to.
@@ -360,11 +332,9 @@ es1800_open (name, from_tty)
      char *name;
      int from_tty;
 {
-  TERMINAL sg;
   char buf[PBUFSIZ];
   char *p;
   int i, fcflag;
-  char *baudrate;
 
   m68020 = 0;
 
@@ -372,7 +342,6 @@ es1800_open (name, from_tty)
     {
       error_no_arg ("serial port device name");
     }
-  baudrate = baud_rate ? baud_rate : "19200";  /* default baudrate = 19200 */
 
   target_preopen (from_tty);
   es1800_close (0);
@@ -381,47 +350,42 @@ es1800_open (name, from_tty)
 
 #ifndef DEBUG_STDIN
 
-  es1800_desc = open (name, O_RDWR);
-  if (es1800_desc < 0)
+  es1800_desc = SERIAL_OPEN (name);
+  if (es1800_desc == NULL)
     {
       perror_with_name (name);
     }
   savename = savestring (name, strlen (name));
 
-  if (ioctl (es1800_desc, TIOCGETP, &sg) == -1)
-    {
-      perror_with_name (name);
-    }
-  es1800_sg_save = sg;
+  es1800_saved_ttystate = SERIAL_GET_TTY_STATE (es1800_desc);
 
-  if ((fcflag = fcntl (es1800_desc, F_GETFL, 0)) == -1)
+  if ((fcflag = fcntl (es1800_desc->fd, F_GETFL, 0)) == -1)
     {
       perror_with_name ("fcntl serial");
     }
   es1800_fc_save = fcflag;
 
   fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */
-  if (fcntl (es1800_desc, F_SETFL, fcflag) == -1)
+  if (fcntl (es1800_desc->fd, F_SETFL, fcflag) == -1)
     {
       perror_with_name ("fcntl serial");
     }
 
-#ifdef HAVE_TERMIO
-  sg.c_cc[VMIN] = 0;           /* read with timeout.  */
-  sg.c_cc[VTIME] = timeout * 10;
-  sg.c_lflag &= ~(ICANON | ECHO);
-  sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate);
-#else
-  sg.sg_ispeed = damn_b (baudrate);
-  sg.sg_ospeed = damn_b (baudrate);
-  sg.sg_flags = CBREAK+TANDEM;
-#endif
-
-  if ((ioctl (es1800_desc, TIOCSETP, &sg)) == -1)
+  if (baud_rate != -1)
     {
-      perror ("es1800_open: error in ioctl");
+      if (SERIAL_SETBAUDRATE (es1800_desc, baud_rate))
+       {
+         SERIAL_CLOSE (es1800_desc);
+         perror_with_name (name);
+       }
     }
 
+  SERIAL_RAW (es1800_desc);
+
+  /* If there is something sitting in the buffer we might take it as a
+     response to a command, which would be bad.  */
+  SERIAL_FLUSH_INPUT (es1800_desc);
+
 #endif /* DEBUG_STDIN */
 
   push_target (&es1800_ops);   /* Switch to using remote target now */
@@ -430,30 +394,6 @@ es1800_open (name, from_tty)
       printf ("Remote ES1800 debugging using %s\n", name);
     }
 
-#ifndef HAVE_TERMIO
-
-#ifndef NO_SIGINTERRUPT
-
-  /* Cause SIGALRM's to make reads fail with EINTR instead of resuming
-     the read.  */
-
-  if (siginterrupt (SIGALRM, 1) != 0)
-    {
-      perror ("es1800_open: error in siginterrupt");
-    }
-
-#endif /* NO_SIGINTERRUPT */
-
-  /* Set up read timeout timer.  */
-
-  if ((void(*)()) signal (SIGALRM, es1800_timer) == (void(*)()) -1)
-    {
-      perror ("es1800_open: error in signal");
-    }
-
-#endif /* HAVE_TERMIO */
-
-
 #if defined (LOG_FILE)
 
   log_file = fopen (LOG_FILE, "w");
@@ -516,13 +456,14 @@ static void
 es1800_close (quitting)
      int quitting;
 {
-  if (es1800_desc >= 0)
+  if (es1800_desc != NULL)
     {
       printf ("\nClosing connection to emulator...\n");
-      ioctl (es1800_desc, TIOCSETP, &es1800_sg_save);
-      fcntl (es1800_desc,F_SETFL, es1800_fc_save);
-      close (es1800_desc);
-      es1800_desc = -1;
+      if (SERIAL_SET_TTY_STATE (es1800_desc, es1800_saved_ttystate) < 0)
+       print_sys_errmsg ("warning: unable to restore tty state", errno);
+      fcntl (es1800_desc->fd, F_SETFL, es1800_fc_save);
+      SERIAL_CLOSE (es1800_desc);
+      es1800_desc = NULL;
     }
   if (savename != NULL)
     {
@@ -549,61 +490,6 @@ es1800_close (quitting)
 
 }
 
-/* damn_b()
-
-   Translate baud rates from integers to damn B_codes.  Unix should
-   have outgrown this crap years ago, but even POSIX wouldn't buck it.
-   rate - the baudrate given as a string
-   return value: the baudrate as a B_code */
-
-#ifndef B19200
-#  define B19200 EXTA
-#endif
-#ifndef B38400
-#  define B38400 EXTB
-#endif
-
-struct
-{
-  char *rate,
-  damn_b;
-} baudtab[] = {
-  {"0", B0},
-  {"50", B50},
-  {"75", B75},
-  {"110", B110},
-  {"134", B134},
-  {"150", B150},
-  {"200", B200},
-  {"300", B300},
-  {"600", B600},
-  {"1200", B1200},
-  {"1800", B1800},
-  {"2400", B2400},
-  {"4800", B4800},
-  {"9600", B9600},
-  {"19200", B19200},
-  {"38400", B38400},
-  {0, -1},
-};
-
-static int
-damn_b (rate)
-     char *rate;
-{
-  int i;
-
-  for (i = 0; baudtab[i].rate != 0; i++)
-    {
-      if (STREQ (rate, baudtab[i].rate))
-       {
-         return (baudtab[i].damn_b);
-       }
-    }
-  error ("Illegal baudrate");
-}
-
-
 /*  Attaches to a process on the target side
     proc_id  - the id of the process to be attached.
     from_tty - says whether to be verbose or not */
@@ -653,7 +539,7 @@ static void
 es1800_resume (pid, step, siggnal)
      int pid;
      int step;
-     int siggnal;
+     enum target_signal siggnal;
 {
   char buf[PBUFSIZ];
 
@@ -677,13 +563,16 @@ es1800_resume (pid, step, siggnal)
    status -  */
  
 static int
-es1800_wait (status)
-     WAITTYPE *status;
+es1800_wait (pid, status)
+     int pid;
+     struct target_waitstatus *status;
 {
   unsigned char buf[PBUFSIZ];
   int old_timeout = timeout;
 
-  WSETEXIT ((*status), 0);
+  status->kind = TARGET_WAITKIND_EXITED;
+  status->value.integer = 0;
+
   timeout = 0;         /* Don't time out -- user program is running. */
   if (!setjmp (interrupt))
     {
@@ -693,7 +582,8 @@ es1800_wait (status)
          getmessage (buf, sizeof(buf));
          if (strncmp ( buf, "\r\n* BREAK *", 11) == 0) 
            {
-             WSETSTOP ((*status), SIGTRAP);
+             status->kind = TARGET_WAITKIND_STOPPED;
+             status->value.sig = TARGET_SIGNAL_TRAP;
              send_command ("STP");     /* Restore stack and PC and such */
              if (m68020)
                {
@@ -703,7 +593,8 @@ es1800_wait (status)
            }
          if (strncmp (buf, "STP\r\n ", 6) == 0)
            {
-             WSETSTOP ((*status), SIGTRAP);
+             status->kind = TARGET_WAITKIND_STOPPED;
+             status->value.sig = TARGET_SIGNAL_TRAP;
              break;
            }
          if (buf[strlen (buf) - 2] == 'R')
@@ -713,7 +604,8 @@ es1800_wait (status)
          else
            {
              printf ("Unexpected stop: \n%s\n", buf);
-             WSETSTOP ((*status), SIGQUIT);
+             status->kind = TARGET_WAITKIND_STOPPED;
+             status->value.sig = TARGET_SIGNAL_QUIT;
              break;
            }
         }
@@ -727,7 +619,8 @@ es1800_wait (status)
          old_sigint = signal (SIGINT, es1800_request_quit);
          send_command ("STP");
          printf (" emulator stopped\n");
-         WSETSTOP ((*status), SIGINT);
+         status->kind = TARGET_WAITKIND_STOPPED;
+         status->value.sig = TARGET_SIGNAL_INT;
         }
       else
        {
@@ -1389,7 +1282,7 @@ es1800_load (filename, from_tty)
   struct cleanup *old_chain;
   int es1800_load_format = 5;
 
-  if (es1800_desc < 0
+  if (es1800_desc == NULL
     {
       printf ("No emulator attached, type emulator-command first\n");
       return;
@@ -1429,7 +1322,7 @@ es1800_load (filename, from_tty)
        error ("Downloading format not defined\n");
     }
  
-  mark_breakpoints_out ();
+  breakpoint_init_inferior ();
   inferior_pid = 0;
   if (from_tty)
     {
@@ -1575,7 +1468,7 @@ es1800_create_inferior (execfile, args, env)
 
   if (execfile == 0 || exec_bfd == 0)
     {
-      error ("No exec file specified");
+      error ("No executable file specified");
     }
 
   entry_pt = (int) bfd_get_start_address (exec_bfd);
@@ -1610,7 +1503,8 @@ es1800_create_inferior (execfile, args, env)
   /* trap_expected = 0; */
   /* insert_step_breakpoint ();  FIXME, do we need this?  */
 
-  proceed ((CORE_ADDR) entry_pt, -1, 0);               /* Let 'er rip... */
+  /* Let 'er rip... */
+  proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0);
 
 }
 
@@ -1710,38 +1604,23 @@ readchar ()
 static int
 readchar ()
 {
-  char buf[1];
-
-  buf[0] = '\0';
+  int ch;
 
-#ifdef HAVE_TERMIO
+  ch = SERIAL_READCHAR (es1800_desc, timeout);
 
-  /* termio does the timeout for us.  */
-  read (es1800_desc, buf, 1);
-
-#else
-
-  alarm (timeout);
-  while (read (es1800_desc, buf, 1) != 1)
-    {
-      if (errno == EINTR)
-       {
-         error ("Timeout reading from remote system.");
-       }
-      else if (errno != EWOULDBLOCK)
-       {
-         perror_with_name ("remote read");
-       }
-    }
-  alarm (0);
-#endif
+  /* FIXME: doing an error() here will probably cause trouble, at least if from
+     es1800_wait.  */
+  if (ch == SERIAL_TIMEOUT)
+    error ("Timeout reading from remote system.");
+  else if (ch == SERIAL_ERROR)
+    perror_with_name ("remote read");
 
 #if defined (LOG_FILE)
-  putc (buf[0] & 0x7f, log_file);
+  putc (ch & 0x7f, log_file);
   fflush (log_file);
 #endif
 
-  return (buf[0] & 0x7f);
+  return (ch);
 }
 
 #endif /* DEBUG_STDIN */
@@ -1759,7 +1638,7 @@ send_with_reply (string, buf, len)
     int len;
 {
   send (string);
-  write (es1800_desc, "\r", 1);
+  SERIAL_WRITE (es1800_desc, "\r", 1);
 
 #ifndef DEBUG_STDIN
   expect (string, 1);
@@ -1779,7 +1658,7 @@ send_command (string)
      char *string;
 {
   send (string);
-  write (es1800_desc, "\r", 1);
+  SERIAL_WRITE (es1800_desc, "\r", 1);
 
 #ifndef DEBUG_STDIN
   expect (string, 0);
@@ -1799,7 +1678,7 @@ send (string)
     {
       fprintf (stderr, "Sending: %s\n", string);
     }
-  write (es1800_desc, string, strlen (string));
+  SERIAL_WRITE (es1800_desc, string, strlen (string));
 }
 
 
@@ -1900,6 +1779,11 @@ FILE *instream;
 
 /* Additional commands */
 
+#if defined (TIOCGETP) && defined (FNDELAY) && defined (EWOULDBLOCK)
+#define PROVIDE_TRANSPARENT
+#endif
+
+#ifdef PROVIDE_TRANSPARENT
 /* Talk directly to the emulator
    FIXME, uses busy wait, and is SUNOS (or at least BSD) specific  */
 
@@ -1925,7 +1809,7 @@ es1800_transparent (args, from_tty)
   int i;
 
   dont_repeat ();
-  if (es1800_desc < 0
+  if (es1800_desc == NULL
     {
       printf ("No emulator attached, type emulator-command first\n");
       return;
@@ -1969,7 +1853,7 @@ es1800_transparent (args, from_tty)
       perror_with_name ("ioctl console");
     }
 
-  if ((fcflag = fcntl (es1800_desc, F_GETFL, 0)) == -1)
+  if ((fcflag = fcntl (es1800_desc->fd, F_GETFL, 0)) == -1)
     {
       perror_with_name ("fcntl serial");
     }
@@ -1977,7 +1861,7 @@ es1800_transparent (args, from_tty)
   es1800_fc_save = fcflag;
   fcflag = fcflag | FNDELAY;
 
-  if (fcntl (es1800_desc, F_SETFL, fcflag) == -1)
+  if (fcntl (es1800_desc->fd, F_SETFL, fcflag) == -1)
     {
       perror_with_name ("fcntl serial");
     }
@@ -1995,9 +1879,9 @@ es1800_transparent (args, from_tty)
            {
              es1800_buf[es1800_cnt++] = inputbuf[i++];
            }
-         if ((cc = write (es1800_desc, es1800_buf, es1800_cnt)) == -1)
+         if ((cc = SERIAL_WRITE (es1800_desc, es1800_buf, es1800_cnt)) == -1)
            {
-             perror_with_name ("FEL! read:");
+             perror_with_name ("FEL! write:");
            }
          es1800_cnt -= cc;
          if (es1800_cnt && cc) 
@@ -2013,7 +1897,7 @@ es1800_transparent (args, from_tty)
          perror_with_name ("FEL! read:");
        }
       
-      cc = read (es1800_desc,inputbuf,inputcnt);
+      cc = read (es1800_desc->fd,inputbuf,inputcnt);
       if (cc != -1)
        {
          for (i = 0; i < cc; )
@@ -2052,7 +1936,7 @@ es1800_transparent (args, from_tty)
 
   close (console);
 
-  if (fcntl (es1800_desc, F_SETFL, es1800_fc_save) == -1)
+  if (fcntl (es1800_desc->fd, F_SETFL, es1800_fc_save) == -1)
     {
       perror_with_name ("FEL! fcntl");
     }
@@ -2060,6 +1944,7 @@ es1800_transparent (args, from_tty)
   printf ("\n");
 
 }
+#endif /* PROVIDE_TRANSPARENT */
 
 static void
 es1800_init_break (args, from_tty)
@@ -2157,107 +2042,161 @@ es1800_child_detach (args, from_tty)
 
 /* Define the target subroutine names  */
 
-static struct target_ops es1800_ops =
+struct target_ops es1800_ops ;
+
+static void 
+init_es1800_ops(void)
 {
-  "es1800",                    /* to_shortname */
-                               /* to_longname */
-  "Remote serial target in ES1800-emulator protocol",
-                               /* to_doc */
-  "Remote debugging on the es1800 emulator via a serial line.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).",
-  es1800_open,                 /* to_open */
-  es1800_close,                        /* to_close */
-  es1800_attach,               /* to_attach */
-  es1800_detach,               /* to_detach */
-  es1800_resume,               /* to_resume */
-  NULL,                                /* to_wait */
-  NULL,                                /* to_fetch_registers */
-  NULL,                                /* to_store_registers */
-  es1800_prepare_to_store,     /* to_prepare_to_store */
-  es1800_xfer_inferior_memory, /* to_xfer_memory */
-  es1800_files_info,           /* to_files_info */
-  es1800_insert_breakpoint,    /* to_insert_breakpoint */
-  es1800_remove_breakpoint,    /* to_remove_breakpoint */
-  NULL,                                /* to_terminal_init */
-  NULL,                                /* to_terminal_inferior */
-  NULL,                                /* to_terminal_ours_for_output */
-  NULL,                                /* to_terminal_ours */
-  NULL,                                /* to_terminal_info */
-  NULL,                                /* to_kill */
-  es1800_load,                 /* to_load */
-  NULL,                                /* to_lookup_symbol */
-  es1800_create_inferior,      /* to_create_inferior */
-  NULL,                                /* to_mourn_inferior */
-  0,                           /* to_can_run */
-  0,                           /* notice_signals */
-  core_stratum,                        /* to_stratum */
-  0,                           /* to_next */
-  0,                           /* to_has_all_memory */
-  1,                           /* to_has_memory */
-  0,                           /* to_has_stack */
-  0,                           /* to_has_registers */
-  0,                           /* to_has_execution */
-  NULL,                                /* to_sections */
-  NULL,                                /* to_sections_end */
-  OPS_MAGIC                    /* to_magic (always last) */
-};
+  es1800_ops.to_shortname =   "es1800";                
+  es1800_ops.to_longname =   "Remote serial target in ES1800-emulator protocol";
+  es1800_ops.to_doc =   "Remote debugging on the es1800 emulator via a serial line.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya)." ;
+  es1800_ops.to_open =   es1800_open;          
+  es1800_ops.to_close =   es1800_close;                
+  es1800_ops.to_attach =   es1800_attach;
+  es1800_ops.to_post_attach = NULL;    
+  es1800_ops.to_require_attach = NULL;
+  es1800_ops.to_detach =   es1800_detach;      
+  es1800_ops.to_require_detach = NULL;
+  es1800_ops.to_resume =   es1800_resume;      
+  es1800_ops.to_wait  =   NULL;
+  es1800_ops.to_post_wait = NULL;      
+  es1800_ops.to_fetch_registers  =   NULL;     
+  es1800_ops.to_store_registers  =   NULL;     
+  es1800_ops.to_prepare_to_store =   es1800_prepare_to_store;
+  es1800_ops.to_xfer_memory  =   es1800_xfer_inferior_memory;
+  es1800_ops.to_files_info  =   es1800_files_info;             
+  es1800_ops.to_insert_breakpoint =   es1800_insert_breakpoint;        
+  es1800_ops.to_remove_breakpoint =   es1800_remove_breakpoint;        
+  es1800_ops.to_terminal_init  =   NULL;                       
+  es1800_ops.to_terminal_inferior =   NULL;                    
+  es1800_ops.to_terminal_ours_for_output =   NULL;             
+  es1800_ops.to_terminal_ours  =   NULL;                       
+  es1800_ops.to_terminal_info  =   NULL;                       
+  es1800_ops.to_kill  =   NULL;                        
+  es1800_ops.to_load  =   es1800_load;         
+  es1800_ops.to_lookup_symbol =   NULL;                
+  es1800_ops.to_create_inferior =   es1800_create_inferior;
+  es1800_ops.to_post_startup_inferior = NULL;
+  es1800_ops.to_acknowledge_created_inferior = NULL;
+  es1800_ops.to_clone_and_follow_inferior = NULL;  
+  es1800_ops.to_post_follow_inferior_by_clone = NULL;
+  es1800_ops.to_insert_fork_catchpoint = NULL;
+  es1800_ops.to_remove_fork_catchpoint = NULL;
+  es1800_ops.to_insert_vfork_catchpoint = NULL;
+  es1800_ops.to_remove_vfork_catchpoint = NULL;              
+  es1800_ops.to_has_forked = NULL;
+  es1800_ops.to_has_vforked = NULL;            
+  es1800_ops.to_can_follow_vfork_prior_to_exec = NULL;    
+  es1800_ops.to_post_follow_vfork = NULL;
+  es1800_ops.to_insert_exec_catchpoint = NULL;
+  es1800_ops.to_remove_exec_catchpoint = NULL;
+  es1800_ops.to_has_execd = NULL;
+  es1800_ops.to_reported_exec_events_per_exec_call = NULL;
+  es1800_ops.to_has_exited = NULL;
+  es1800_ops.to_mourn_inferior =   NULL;                       
+  es1800_ops.to_can_run  =   0;                        
+  es1800_ops.to_notice_signals =   0;          
+  es1800_ops.to_thread_alive  =   0;           
+  es1800_ops.to_stop  =   0;
+  es1800_ops.to_pid_to_exec_file = NULL;
+  es1800_ops.to_core_file_to_sym_file = NULL;  
+  es1800_ops.to_stratum =   core_stratum;      
+  es1800_ops.DONT_USE =   0;                   
+  es1800_ops.to_has_all_memory =   0;          
+  es1800_ops.to_has_memory =   1;              
+  es1800_ops.to_has_stack =   0;               
+  es1800_ops.to_has_registers =   0;           
+  es1800_ops.to_has_execution =   0;           
+  es1800_ops.to_sections =   NULL;             
+  es1800_ops.to_sections_end =   NULL;         
+  es1800_ops.to_magic =   OPS_MAGIC ;          
+}
 
 /* Define the target subroutine names  */
 
-static struct target_ops es1800_child_ops =
+struct target_ops es1800_child_ops ;
+
+static void 
+init_es1800_child_ops(void)
 {
-  "es1800_process",            /* to_shortname */
-                               /* to_longname */
-  "Remote serial target in ES1800-emulator protocol",
-                               /* to_doc */
-  "Remote debugging on the es1800 emulator via a serial line.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).",
-  es1800_child_open,           /* to_open */
-  NULL,                                /* to_close */
-  es1800_attach,               /* to_attach */
-  es1800_child_detach,         /* to_detach */
-  es1800_resume,               /* to_resume */
-  es1800_wait,                 /* to_wait */
-  es1800_fetch_register,       /* to_fetch_registers */
-  es1800_store_register,       /* to_store_registers */
-  es1800_prepare_to_store,     /* to_prepare_to_store */
-  es1800_xfer_inferior_memory, /* to_xfer_memory */
-  es1800_files_info,           /* to_files_info */
-  es1800_insert_breakpoint,    /* to_insert_breakpoint */
-  es1800_remove_breakpoint,    /* to_remove_breakpoint */
-  NULL,                                /* to_terminal_init */
-  NULL,                                /* to_terminal_inferior */
-  NULL,                                /* to_terminal_ours_for_output */
-  NULL,                                /* to_terminal_ours */
-  NULL,                                /* to_terminal_info */
-  es1800_kill,                 /* to_kill */
-  es1800_load,                 /* to_load */
-  NULL,                                /* to_lookup_symbol */
-  es1800_create_inferior,      /* to_create_inferior */
-  es1800_mourn_inferior,       /* to_mourn_inferior */
-  0,                           /* to_can_run */
-  0,                           /* notice_signals */
-  process_stratum,             /* to_stratum */
-  0,                           /* to_next */
-  1,                           /* to_has_all_memory */
-  1,                           /* to_has_memory */
-  1,                           /* to_has_stack */
-  1,                           /* to_has_registers */
-  1,                           /* to_has_execution */
-  NULL,                                /* to_sections */
-  NULL,                                /* to_sections_end */
-  OPS_MAGIC                    /* to_magic (always last) */
-};
-
-/* _initialize_es1800 ()  */
+  es1800_child_ops.to_shortname =   "es1800_process";  
+  es1800_child_ops.to_longname =   "Remote serial target in ES1800-emulator protocol";
+  es1800_child_ops.to_doc =   "Remote debugging on the es1800 emulator via a serial line.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+  es1800_child_ops.to_open =   es1800_child_open;      
+  es1800_child_ops.to_close =   NULL;                  
+  es1800_child_ops.to_attach =   es1800_attach;
+  es1800_child_ops.to_post_attach = NULL;
+  es1800_child_ops.to_require_attach = NULL;   
+  es1800_child_ops.to_detach =   es1800_child_detach;
+  es1800_child_ops.to_require_detach = NULL;   
+  es1800_child_ops.to_resume =   es1800_resume;        
+  es1800_child_ops.to_wait  =   es1800_wait;
+  es1800_child_ops.to_post_wait = NULL;        
+  es1800_child_ops.to_fetch_registers  =   es1800_fetch_register;
+  es1800_child_ops.to_store_registers  =   es1800_store_register;
+  es1800_child_ops.to_prepare_to_store =   es1800_prepare_to_store;
+  es1800_child_ops.to_xfer_memory  =   es1800_xfer_inferior_memory;
+  es1800_child_ops.to_files_info  =   es1800_files_info;               
+  es1800_child_ops.to_insert_breakpoint =   es1800_insert_breakpoint;  
+  es1800_child_ops.to_remove_breakpoint =   es1800_remove_breakpoint;  
+  es1800_child_ops.to_terminal_init  =   NULL;                 
+  es1800_child_ops.to_terminal_inferior =   NULL;                      
+  es1800_child_ops.to_terminal_ours_for_output =   NULL;               
+  es1800_child_ops.to_terminal_ours  =   NULL;                 
+  es1800_child_ops.to_terminal_info  =   NULL;                 
+  es1800_child_ops.to_kill  =   es1800_kill;                   
+  es1800_child_ops.to_load  =   es1800_load;                   
+  es1800_child_ops.to_lookup_symbol =   NULL;                  
+  es1800_child_ops.to_create_inferior =   es1800_create_inferior;
+  es1800_child_ops.to_post_startup_inferior = NULL;
+  es1800_child_ops.to_acknowledge_created_inferior = NULL;
+  es1800_child_ops.to_clone_and_follow_inferior = NULL;
+  es1800_child_ops.to_post_follow_inferior_by_clone = NULL;
+  es1800_child_ops.to_insert_fork_catchpoint = NULL;
+  es1800_child_ops.to_remove_fork_catchpoint = NULL;
+  es1800_child_ops.to_insert_vfork_catchpoint = NULL;
+  es1800_child_ops.to_remove_vfork_catchpoint = NULL;        
+  es1800_child_ops.to_has_forked = NULL;
+  es1800_child_ops.to_has_vforked = NULL;          
+  es1800_child_ops.to_can_follow_vfork_prior_to_exec = NULL;
+  es1800_child_ops.to_post_follow_vfork = NULL;
+  es1800_child_ops.to_insert_exec_catchpoint = NULL;
+  es1800_child_ops.to_remove_exec_catchpoint = NULL;
+  es1800_child_ops.to_has_execd = NULL;
+  es1800_child_ops.to_reported_exec_events_per_exec_call = NULL;
+  es1800_child_ops.to_has_exited = NULL;
+  es1800_child_ops.to_mourn_inferior =   es1800_mourn_inferior;        
+  es1800_child_ops.to_can_run  =   0;                          
+  es1800_child_ops.to_notice_signals =   0;                    
+  es1800_child_ops.to_thread_alive  =   0;                     
+  es1800_child_ops.to_stop  =   0;
+  es1800_child_ops.to_pid_to_exec_file = NULL;
+  es1800_child_ops.to_core_file_to_sym_file = NULL;
+  es1800_child_ops.to_stratum =   process_stratum;             
+  es1800_child_ops.DONT_USE =   0;                             
+  es1800_child_ops.to_has_all_memory =   1;                    
+  es1800_child_ops.to_has_memory =   1;                        
+  es1800_child_ops.to_has_stack =   1;                 
+  es1800_child_ops.to_has_registers =   1;                     
+  es1800_child_ops.to_has_execution =   1;                     
+  es1800_child_ops.to_sections =   NULL;                       
+  es1800_child_ops.to_sections_end =   NULL;                   
+  es1800_child_ops.to_magic =   OPS_MAGIC;                     
+}
 
 void
 _initialize_es1800 ()
 {
+  init_es1800_ops() ;
+  init_es1800_child_ops() ;
   add_target (&es1800_ops);
   add_target (&es1800_child_ops);
+#ifdef PROVIDE_TRANSPARENT
   add_com ("transparent", class_support, es1800_transparent,
           "Start transparent communication with the ES 1800 emulator.");
+#endif /* PROVIDE_TRANSPARENT */
   add_com ("init_break", class_support, es1800_init_break,
           "Download break routine and initialize break facility on ES 1800");
 }
This page took 0.032423 seconds and 4 git commands to generate.