]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Split non-target-dependent code out of target_attach routines.
authorJohn Gilmore <gnu@cygnus>
Sat, 26 Sep 1992 05:20:24 +0000 (05:20 +0000)
committerJohn Gilmore <gnu@cygnus>
Sat, 26 Sep 1992 05:20:24 +0000 (05:20 +0000)
* target.h:  Comments on target_attach args and results.
* infcmd.c (attach_command): Check for existing execution, call
target_attach, set up terminal status and wait_for_inferior, wait
for the attach status, and do normal_stop.
* inftarg.c (child_attach):  Remove target independent stuff.
* remote-adapt.c (adapt_attach):  Ditto.
* remote-mm.c (mm_attach):  Ditto.
* remote-udi.c (udi_attach):  Ditto.
* remote-vx.c (vx_attach):  Ditto.

Cleanup.

* remote-hms.c (hms_attach):  Remove completely, it was useless.
* remote-mm.c, remote-hms.c, remote-udi.c, remote-adapt.c:  Remove
commented-out start_remote calls.
* remote-hms.c, remote-adapt.c, remote-mm.c, remote-udi.c: Remove
DENTER and DEXIT macros and their calls.  Use a real debugger --
like gdb -- to see what functions are being called when.

gdb/ChangeLog
gdb/inftarg.c
gdb/remote-adapt.c
gdb/remote-hms.c
gdb/remote-mm.c
gdb/remote-udi.c
gdb/remote-vx.c
gdb/target.h

index 2ce5bd36a3cc142ea6aebf5f105e9baf2fe61fd7..7f7d4f9a41299a0caeb1ff005cfe177603a70950 100644 (file)
@@ -1,3 +1,26 @@
+Fri Sep 25 21:59:27 1992  John Gilmore  (gnu@cygnus.com)
+
+       Split non-target-dependent code out of target_attach routines.
+
+       * target.h:  Comments on target_attach args and results.
+       * infcmd.c (attach_command): Check for existing execution, call
+       target_attach, set up terminal status and wait_for_inferior, wait
+       for the attach status, and do normal_stop.
+       * inftarg.c (child_attach):  Remove target independent stuff.
+       * remote-adapt.c (adapt_attach):  Ditto.
+       * remote-mm.c (mm_attach):  Ditto.
+       * remote-udi.c (udi_attach):  Ditto.
+       * remote-vx.c (vx_attach):  Ditto.
+
+       Cleanup.
+
+       * remote-hms.c (hms_attach):  Remove completely, it was useless.
+       * remote-mm.c, remote-hms.c, remote-udi.c, remote-adapt.c:  Remove
+       commented-out start_remote calls.
+       * remote-hms.c, remote-adapt.c, remote-mm.c, remote-udi.c: Remove
+       DENTER and DEXIT macros and their calls.  Use a real debugger --
+       like gdb -- to see what functions are being called when.
+
 Fri Sep 25 18:48:20 1992  John Gilmore  (gnu@cygnus.com)
 
        * infrun.c, inftarg.c, inferior.h:  Comment and lint cleanups.
index 5717408f65a90529f0645717583b36bb3686b39a..e357c0ebbe62779b62b00dc4628587a2566e15f1 100644 (file)
@@ -94,8 +94,7 @@ child_wait (status)
 }
 
 
-/* Attach to process PID, then initialize for debugging it
-   and wait for the trace-trap that results from attaching.  */
+/* Attach to process PID, then initialize for debugging it.  */
 
 static void
 child_attach (args, from_tty)
@@ -105,8 +104,6 @@ child_attach (args, from_tty)
   char *exec_file;
   int pid;
 
-  dont_repeat();
-
   if (!args)
     error_no_arg ("process-id to attach");
 
@@ -118,14 +115,6 @@ child_attach (args, from_tty)
   if (pid == getpid())         /* Trying to masturbate? */
     error ("I refuse to debug myself!");
 
-  if (target_has_execution)
-    {
-      if (query ("A program is being debugged already.  Kill it? "))
-       target_kill ();
-      else
-       error ("Inferior not killed.");
-    }
-
   if (from_tty)
     {
       exec_file = (char *) get_exec_file (0);
@@ -141,18 +130,6 @@ child_attach (args, from_tty)
   attach (pid);
   inferior_pid = pid;
   push_target (&child_ops);
-
-  mark_breakpoints_out ();
-  target_terminal_init ();
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  /*proceed (-1, 0, -2);*/
-  target_terminal_inferior ();
-  wait_for_inferior ();
-#ifdef SOLIB_ADD
-  SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0);
-#endif
-  normal_stop ();
 #endif  /* ATTACH_DETACH */
 }
 
index 9241573eeced0df519d62968627a39f1ab9b037a..374c9dec49aa5616494c4fe56c9f9a8850d9360d 100644 (file)
@@ -68,16 +68,6 @@ static int processor_type=TYPE_UNKNOWN;
 #define FREEZE_MODE    (read_register(CPS_REGNUM) && 0x400) 
 #define USE_SHADOW_PC   ((processor_type == TYPE_A29050) && FREEZE_MODE)
 
-
-/* #define DEBUG       /* */
-#ifdef DEBUG
-# define DENTER(NAME)   (printf_filtered("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME)    (printf_filtered("Exiting  %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
 /* Can't seem to get binary coff working */
 #define ASCII_COFF             /* Adapt will be downloaded with ascii coff */
 
@@ -325,11 +315,9 @@ adapt_kill(arg,from_tty)
 char   *arg;
 int    from_tty;
 {
-       DENTER("adapt_kill()");
        fprintf (adapt_stream, "K");
        fprintf (adapt_stream, "\r");
        expect_prompt ();
-       DEXIT("adapt_kill()");
 }
 /*
  * Download a file specified in 'args', to the adapt. 
@@ -344,7 +332,6 @@ int fromtty;
        int     n;
        char    buffer[1024];
        
-       DENTER("adapt_load()");
        if (!adapt_stream) {
                printf_filtered("Adapt not open. Use 'target' command to open adapt\n");
                return;
@@ -384,7 +371,6 @@ int fromtty;
        expect_prompt ();       /* Skip garbage that comes out */
        fprintf (adapt_stream, "\r");
        expect_prompt ();
-       DEXIT("adapt_load()");
 }
 
 /* This is called not only when we first attach, but also when the
@@ -397,8 +383,6 @@ adapt_create_inferior (execfile, args, env)
 {
   int entry_pt;
 
-  DENTER("adapt_create_inferior()");
-
   if (args && *args)
     error ("Can't pass arguments to remote adapt process.");
 
@@ -439,7 +423,6 @@ adapt_create_inferior (execfile, args, env)
   } else {
        printf_filtered("Adapt not open yet.\n");
   }
-  DEXIT("adapt_create_inferior()");
 }
 
 /* Translate baud rates from integers to damn B_codes.  Unix should
@@ -498,7 +481,6 @@ adapt_open (name, from_tty)
   unsigned int prl;
   char *p;
 
-  DENTER("adapt_open()");
   /* Find the first whitespace character, it separates dev_name from
      prog_name.  */
   if (name == 0)
@@ -555,8 +537,6 @@ the baud rate, and the name of the program to run on the remote system.");
   adapt_stream = fdopen (adapt_desc, "r+");
 
   push_target (&adapt_ops);
-  /* start_remote ();              /* Initialize gdb process mechanisms */
-
 
 #ifndef HAVE_TERMIO
 #ifndef NO_SIGINTERRUPT
@@ -615,7 +595,6 @@ the baud rate, and the name of the program to run on the remote system.");
        fprintf_filtered(stderr,
        "Freeze-mode debugging not available, and can only be done on an A29050.\n");
   }
-  DEXIT("adapt_open()");
 }
 
 /* Close out all files and local state before this target loses control. */
@@ -625,8 +604,6 @@ adapt_close (quitting)
      int quitting;
 {
 
-  DENTER("adapt_close()");
-
   /* Clear any break points */
   adapt_clear_breakpoints();
 
@@ -658,7 +635,6 @@ adapt_close (quitting)
     log_file = NULL;
   }
 #endif
-  DEXIT("adapt_close()");
 }
 
 /* Attach to the target that is already loaded and possibly running */
@@ -668,26 +644,12 @@ adapt_attach (args, from_tty)
      int from_tty;
 {
 
-  DENTER("adapt_attach()");
   if (from_tty)
       printf_filtered ("Attaching to remote program %s.\n", prog_name);
 
-  /* push_target(&adapt_ops);  /* This done in adapt_open() */
-
-  mark_breakpoints_out ();
-
   /* Send the adapt a kill. It is ok if it is not already running */
   fprintf(adapt_stream, "K\r"); fflush(adapt_stream);
   expect_prompt();             /* Slurp the echo */
-
-  /* We will get a task spawn event immediately.  */
-  init_wait_for_inferior ();
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  wait_for_inferior ();
-  stop_soon_quietly = 0;
-  normal_stop ();
-  DEXIT("adapt_attach()");
 }
 
 
@@ -699,7 +661,7 @@ adapt_detach (args,from_tty)
      char *args;
      int from_tty;
 {
-  DENTER("adapt_detach()");
+
   if (adapt_stream) { /* Send it on its way (tell it to continue)  */
        adapt_clear_breakpoints();
        fprintf(adapt_stream,"G\r");
@@ -708,7 +670,6 @@ adapt_detach (args,from_tty)
   pop_target();                /* calls adapt_close to do the real work */
   if (from_tty)
     printf_filtered ("Ending remote %s debugging\n", target_shortname);
-  DEXIT("adapt_detach()");
 }
  
 /* Tell the remote machine to resume.  */
@@ -717,7 +678,6 @@ void
 adapt_resume (step, sig)
      int step, sig;
 {
-  DENTER("adapt_resume()");
   if (step)    
     {
       write (adapt_desc, "t 1,s\r", 6);
@@ -739,7 +699,6 @@ adapt_resume (step, sig)
       /* Swallow the echo.  */
       expect_prompt(); 
     }
-  DEXIT("adapt_resume()");
 }
 
 /* Wait until the remote machine stops, then return,
@@ -772,8 +731,6 @@ adapt_wait (status)
   int old_timeout = timeout;
   int old_immediate_quit = immediate_quit;
 
-  DENTER("adapt_wait()");
-
   WSETEXIT ((*status), 0);
 
   if (need_artificial_trap != 0)
@@ -824,7 +781,6 @@ adapt_wait (status)
     WSETEXIT ((*status), 0);
   timeout = old_timeout;
   immediate_quit = old_immediate_quit;
-  DEXIT("adapt_wait()");
   return 0;
 }
 
@@ -876,8 +832,6 @@ adapt_fetch_registers ()
   int  sreg_buf[16];
   int i,j;
 
-  DENTER("adapt_fetch_registers()");
-
 /* 
  * Global registers
  */
@@ -979,8 +933,6 @@ adapt_fetch_registers ()
   expect ("GR001 ");
   get_hex_regs (1, GR1_REGNUM);
   expect_prompt ();
-
-  DEXIT("adapt_fetch_registers()");
 }
 
 /* Fetch register REGNO, or all registers if REGNO is -1.
@@ -989,7 +941,6 @@ static void
 adapt_fetch_register (regno)
      int regno;
 {
-  DENTER("adapt_fetch_register()");
   if (regno == -1)
     adapt_fetch_registers ();
   else
@@ -1001,7 +952,6 @@ adapt_fetch_register (regno)
       get_hex_regs (1, regno);
       expect_prompt ();
     }
-  DEXIT("adapt_fetch_register()");
 }
 
 /* Store the remote registers from the contents of the block REGS.  */
@@ -1011,7 +961,6 @@ adapt_store_registers ()
 {
   int i, j;
 
-  DENTER("adapt_store_registers()");
   fprintf (adapt_stream, "s gr1,%x\r", read_register (GR1_REGNUM));
   expect_prompt ();
 
@@ -1084,7 +1033,6 @@ adapt_store_register (regno)
        registers_changed ();
       expect_prompt ();
     }
-  DEXIT("adapt_store_registers()");
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -1157,9 +1105,7 @@ adapt_write_inferior_memory (memaddr, myaddr, len)
   int i;
   unsigned int cps;
 
-  /* DENTER("adapt_write_inferior_memory()"); */
-
-/* Turn TU bit off so we can do 'sb' commands */
+  /* Turn TU bit off so we can do 'sb' commands */
   cps = read_register(CPS_REGNUM);
   if (cps & 0x00000800)
        write_register(CPS_REGNUM,cps&~(0x00000800));
@@ -1179,7 +1125,6 @@ adapt_write_inferior_memory (memaddr, myaddr, len)
   /* Restore the old value of cps if the TU bit was on */
   if (cps & 0x00000800)
        write_register(CPS_REGNUM,cps);
-  /* DEXIT("adapt_write_inferior_memory()"); */
   return len;
 }
 
@@ -1211,7 +1156,6 @@ adapt_read_inferior_memory(memaddr, myaddr, len)
      adapt_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
      doesn't need to work.  Detect it and give up if there's an attempt
      to do that.  */
-  /* DENTER("adapt_read_inferior_memory()"); */
 
   if (((memaddr - 1) + len) < memaddr)
     return EIO;
@@ -1256,8 +1200,6 @@ adapt_read_inferior_memory(memaddr, myaddr, len)
 
       startaddr += len_this_pass;
     }
-
-  /* DEXIT("adapt_read_inferior_memory()"); */
   return count;
 }
 
@@ -1268,18 +1210,15 @@ adapt_insert_breakpoint(addr, save)
 CORE_ADDR      addr;
 char           *save;  /* Throw away, let adapt save instructions */
 {
-  DENTER("adapt_insert_breakpoint()"); 
   if (num_brkpts < MAX_BREAKS) {
        num_brkpts++;
        fprintf (adapt_stream, "B %x", addr);
        fprintf (adapt_stream, "\r");
        expect_prompt ();
-       DEXIT("adapt_insert_breakpoint() success"); 
        return(0);      /* Success */
   } else {
        fprintf_filtered(stderr,
                "Too many break points, break point not installed\n");
-       DEXIT("adapt_insert_breakpoint() failure"); 
        return(1);      /* Failure */
   }
 
@@ -1289,7 +1228,6 @@ adapt_remove_breakpoint(addr, save)
 CORE_ADDR      addr;
 char           *save;  /* Throw away, let adapt save instructions */
 {
-  DENTER("adapt_remove_breakpoint()");
   if (num_brkpts > 0) {
          num_brkpts--;
          fprintf (adapt_stream, "BR %x", addr);
@@ -1297,7 +1235,6 @@ char              *save;  /* Throw away, let adapt save instructions */
          fflush (adapt_stream);
          expect_prompt ();
   }
-  DEXIT("adapt_remove_breakpoint()");
   return(0);
 }
 
@@ -1305,7 +1242,6 @@ char              *save;  /* Throw away, let adapt save instructions */
 static int
 adapt_clear_breakpoints() 
 { 
-  DENTER("adapt_clear_breakpoint()");
   if (adapt_stream) {
        fprintf (adapt_stream, "BR");   /* Clear all break points */
        fprintf (adapt_stream, "\r");
@@ -1313,16 +1249,13 @@ adapt_clear_breakpoints()
        expect_prompt ();
   }
   num_brkpts = 0;
-  DEXIT("adapt_clear_breakpoint()");
 }
 static void
 adapt_mourn() 
 { 
-  DENTER("adapt_mourn()");
   adapt_clear_breakpoints();
   pop_target ();                /* Pop back to no-child state */
   generic_mourn_inferior ();
-  DEXIT("adapt_mourn()");
 }
 
 /* Display everthing we read in from the adapt until we match/see the
index fc260f1a5743d3efd109125f7f4386c669cd1362..23afa481dab38d75a6d2b7c4a7af9ecd9950e4c7 100644 (file)
@@ -49,15 +49,6 @@ extern struct target_ops hms_ops;
 
 static int quiet = 1;
 
-#ifdef DEBUG
-# define DENTER(NAME) if (!quiet)  (printf_filtered("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME)  if (!quiet)  (printf_filtered("Exiting  %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
-
 /***********************************************************************/
 /* Caching stuff stolen from remote-nindy.c  */
 
@@ -417,8 +408,6 @@ int fromtty;
   int  n;
   char buffer[1024];
 
-   
-  DENTER("hms_load()");
   check_open();
 
   dcache_flush();
@@ -466,8 +455,6 @@ int fromtty;
   sprintf(buffer, "r PC=%x", abfd->start_address);
   hms_write_cr(buffer);
   expect_prompt();
-  
-  DEXIT("hms_load()");
 }
 
 /* This is called not only when we first attach, but also when the
@@ -480,7 +467,6 @@ hms_create_inferior (execfile, args, env)
 {
   int entry_pt;
   char buffer[100];    
-  DENTER("hms_create_inferior()");
 
   if (args && *args)
    error ("Can't pass arguments to remote hms process.");
@@ -500,9 +486,6 @@ hms_create_inferior (execfile, args, env)
 
   insert_breakpoints ();       /* Needed to get correct instruction in cache */
   proceed(entry_pt, -1, 0);
-
-
-  DEXIT("hms_create_inferior()");
 }
 
 
@@ -605,27 +588,21 @@ hms_open (name, from_tty)
   unsigned int prl;
   char *p;
   
-  DENTER("hms_open()");
   if(name == 0) 
   {
     name = "";
-    
   }
   if (is_open)  
-   hms_close (0);
+    hms_close (0);
   if (name && strlen(name))
-   dev_name = strdup(name);
+    dev_name = strdup(name);
   if (!serial_open(dev_name))
-   perror_with_name ((char *)dev_name);
+    perror_with_name ((char *)dev_name);
   serial_raw();
   is_open = 1;
 
-
   dcache_init();
 
-
-  /* start_remote ();              /* Initialize gdb process mechanisms */
-
   get_baudrate_right();
   
   /* Hello?  Are you there?  */
@@ -635,10 +612,7 @@ hms_open (name, from_tty)
   /* Clear any break points */
   hms_clear_breakpoints();
 
-
   printf_filtered("Connected to remote H8/300 HMS system.\n");
-
-  DEXIT("hms_open()");
 }
 
 /* Close out all files and local state before this target loses control. */
@@ -648,7 +622,6 @@ hms_close (quitting)
      int quitting;
 {
 
-  DENTER("hms_close()");
 
   /* Clear any break points */
   hms_clear_breakpoints();
@@ -658,39 +631,8 @@ hms_close (quitting)
   serial_write("R\r", 2);
   serial_close();
   is_open = 0;
-
-  DEXIT("hms_close()");
 }
 
-/* Attach to the target that is already loaded and possibly running */
-static void
-hms_attach (args, from_tty)
-     char *args;
-     int from_tty;
-{
-
-  DENTER("hms_attach()");
-
-  /* push_target(&hms_ops);    /* This done in hms_open() */
-
-  mark_breakpoints_out ();
-
-  /* Send the hms a kill. It is ok if it is not already running */
-#if 0
-  fprintf(hms_stream, "K\r"); 
-  expect_prompt();             /* Slurp the echo */
-#endif
-  /* We will get a task spawn event immediately.  */
-  init_wait_for_inferior ();
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  wait_for_inferior ();
-  stop_soon_quietly = 0;
-  normal_stop ();
-  DEXIT("hms_attach()");
-}
-
-
 /* Terminate the open connection to the remote debugger.
    Use this when you want to detach and do something else
    with your gdb.  */
@@ -699,7 +641,6 @@ hms_detach (args,from_tty)
      char *args;
      int from_tty;
 {
-  DENTER("hms_detach()");
   if (is_open)
   { 
        hms_clear_breakpoints();
@@ -708,7 +649,6 @@ hms_detach (args,from_tty)
   pop_target();                /* calls hms_close to do the real work */
   if (from_tty)
     printf_filtered ("Ending remote %s debugging\n", target_shortname);
-  DEXIT("hms_detach()");
 }
  
 /* Tell the remote machine to resume.  */
@@ -717,7 +657,6 @@ void
 hms_resume (step, sig)
      int step, sig;
 {
-  DENTER("hms_resume()");
   dcache_flush();
   
   if (step)    
@@ -735,7 +674,6 @@ hms_resume (step, sig)
     hms_write_cr("g");
     expect("g");
   }
-  DEXIT("hms_resume()");
 }
 
 /* Wait until the remote machine stops, then return,
@@ -769,8 +707,6 @@ hms_wait (status)
   int old_immediate_quit = immediate_quit;
   int swallowed_cr = 0;
   
-  DENTER("hms_wait()");
-
   WSETEXIT ((*status), 0);
 
   if (need_artificial_trap != 0)
@@ -844,7 +780,6 @@ hms_wait (status)
   
   timeout = old_timeout;
   immediate_quit = old_immediate_quit;
-  DEXIT("hms_wait()");
   return 0;
 }
 
@@ -1009,9 +944,6 @@ hms_store_register (regno)
     hms_write_cr(buffer);
     expect_prompt();
   }
-  
-  DEXIT("hms_store_registers()");
-
 }
 
 
@@ -1296,7 +1228,6 @@ hms_insert_breakpoint(addr, save)
 CORE_ADDR      addr;
 char           *save;  /* Throw away, let hms save instructions */
 {
-  DENTER("hms_insert_breakpoint()"); 
   check_open();
   
   if (num_brkpts < MAX_BREAKS) 
@@ -1306,14 +1237,12 @@ char            *save;  /* Throw away, let hms save instructions */
     sprintf(buffer,"b %x", addr & 0xffff);
     hms_write_cr(buffer);
     expect_prompt ();
-    DEXIT("hms_insert_breakpoint() success"); 
     return(0);
   }
   else 
   {
     fprintf_filtered(stderr,
                     "Too many break points, break point not installed\n");
-    DEXIT("hms_insert_breakpoint() failure"); 
     return(1);
   }
 
@@ -1324,7 +1253,6 @@ hms_remove_breakpoint(addr, save)
 CORE_ADDR      addr;
 char           *save;  /* Throw away, let hms save instructions */
 {
-  DENTER("hms_remove_breakpoint()");
   if (num_brkpts > 0) 
   {
     char buffer[100];
@@ -1335,7 +1263,6 @@ char              *save;  /* Throw away, let hms save instructions */
     expect_prompt();
       
   }
-  DEXIT("hms_remove_breakpoint()");
   return(0);
 }
 
@@ -1344,21 +1271,17 @@ static int
 hms_clear_breakpoints() 
 { 
 
-  DENTER("hms_clear_breakpoint()");
   if (is_open) {
     hms_write_cr("b -");
     expect_prompt ();
   }
   num_brkpts = 0;
-  DEXIT("hms_clear_breakpoint()");
 }
 static void
 hms_mourn() 
 { 
-  DENTER("hms_mourn()");
   hms_clear_breakpoints();
   generic_mourn_inferior ();
-  DEXIT("hms_mourn()");
 }
 
 
@@ -1393,7 +1316,7 @@ struct target_ops hms_ops = {
 by a serial line.",
 
        hms_open, hms_close, 
-       hms_attach, hms_detach, hms_resume, hms_wait,
+       0, hms_detach, hms_resume, hms_wait,    /* attach */
        hms_fetch_register, hms_store_register,
        hms_prepare_to_store,
        hms_xfer_inferior_memory, 
index fb9060b015a450e6f886eb005b19a7b2dfdf46f1..f62b64d9fa57bd40223e8617e3bc6fdd32168939 100644 (file)
@@ -45,15 +45,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Offset of member MEMBER in a struct of type TYPE.  */
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
 
-/* #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 
-
 #define DRAIN_INPUT()  (msg_recv_serial((union msg_t*)0))
 
 extern int stop_soon_quietly;           /* for wait_for_inferior */
@@ -175,8 +166,6 @@ mm_create_inferior (execfile, args, env)
    char        *token[MAX_TOKENS];
    char        cmd_line[BUFFER_SIZE];
 
-  DENTER("mm_create_inferior()");
-
   if (args && *args)
     error ("Can't pass arguments to remote mm process (yet).");
 
@@ -196,26 +185,18 @@ mm_create_inferior (execfile, args, env)
 Assuming you are at NYU debuging a kernel, i.e., no need to download.\n\n");
 
   /* 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 ();
   stop_soon_quietly = 1;
   proceed(-1,-1,0);
   normal_stop ();
-#endif
-  DEXIT("mm_create_inferior()");
 }
 /**************************************************** REMOTE_MOURN_INFERIOR */
 static void
 mm_mourn()
 {
-  DENTER("mm_mourn()");
         pop_target ();                /* Pop back to no-child state */
         generic_mourn_inferior ();
-  DEXIT("mm_mourn()");
 }
 
 /********************************************************************** damn_b
@@ -279,8 +260,6 @@ mm_open (name, from_tty)
   unsigned int prl;
   char *p;
 
-  DENTER("mm_open()");
-
   /* Find the first whitespace character, it separates dev_name from
      prog_name.  */
   for (p = name;
@@ -431,8 +410,6 @@ erroid:
   out_msg_buf->go_msg.length = 0;
   msg_send_serial(out_msg_buf);
   /* No message to expect after a GO */
-
-  DEXIT("mm_open()");
 }
 
 /**************************************************************** REMOTE_CLOSE
@@ -443,8 +420,6 @@ static void
 mm_close (quitting)    /*FIXME: how is quitting used */
      int quitting;
 {
-  DENTER("mm_close()");
-
   if (mm_desc < 0)
     error ("Can't close remote connection: not debugging remotely.");
 
@@ -470,9 +445,6 @@ mm_close (quitting) /*FIXME: how is quitting used */
 #endif
 
   printf ("Ending remote debugging\n");
-
-  DEXIT("mm_close()");
-
 } 
 
 /************************************************************* REMOTE_ATACH */
@@ -485,17 +457,12 @@ mm_attach (args, from_tty)
      int from_tty;
 {
 
-  DENTER("mm_attach()");
-
   if (!mm_stream)
       error ("MiniMon not opened yet, use the 'target minimon' command.\n");
        
-  dont_repeat();
-
   if (from_tty)
       printf ("Attaching to remote program %s...\n", prog_name);
 
-
   /* Make sure the target is currently running, it is supposed to be. */
   /* FIXME: is it ok to send MiniMon a BREAK if it is already stopped in 
    *   the dbg core.  If so, we don't need to send this GO.
@@ -509,16 +476,6 @@ mm_attach (args, from_tty)
   out_msg_buf->break_msg.code = BREAK;
   out_msg_buf->break_msg.length = 0;
   msg_send_serial(out_msg_buf);
-
-  mark_breakpoints_out ();
-  init_wait_for_inferior ();
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  wait_for_inferior ();
-  stop_soon_quietly = 0;
-  normal_stop ();
-
-  DEXIT("mm_attach()");
 }
 /********************************************************** REMOTE_DETACH */
 /* Terminate the open connection to the remote debugger.
@@ -529,13 +486,11 @@ mm_detach (args,from_tty)
      char *args;
      int from_tty;
 {
-  DENTER("mm_dettach()");
   remove_breakpoints();                /* Just in case there were any left in */
   out_msg_buf->go_msg.code = GO;
   out_msg_buf->go_msg.length = 0;
   msg_send_serial(out_msg_buf);
   pop_target();                /* calls mm_close to do the real work */
-  DEXIT("mm_dettach()");
 }
 
 
@@ -546,8 +501,6 @@ static void
 mm_resume (step, sig)
      int step, sig;
 {
-  DENTER("mm_resume()");
-
   if (sig)
     error ("Can't send signals to a remote MiniMon system.");
 
@@ -561,8 +514,6 @@ mm_resume (step, sig)
       out_msg_buf->go_msg.length = 0;
       msg_send_serial(out_msg_buf);
   }
-
-  DEXIT("mm_resume()");
 }
 
 /***************************************************************** REMOTE_WAIT
@@ -577,7 +528,6 @@ mm_wait (status)
   int old_timeout = timeout;
   int old_immediate_quit = immediate_quit;
 
-  DENTER("mm_wait()");
   WSETEXIT ((*status), 0);
 
 
@@ -688,7 +638,6 @@ exit:
 
   timeout = old_timeout;       /* Restore original timeout value */
   immediate_quit = old_immediate_quit;
-  DEXIT("mm_wait()");
   return 0;
 }
 
@@ -707,8 +656,6 @@ int regno;
        return;
   }
 
-  DENTER("mm_fetch_registers()");
-
 /* Gr1/rsp */
   out_msg_buf->read_req_msg.byte_count = 4*1;
   out_msg_buf->read_req_msg.memory_space = GLOBAL_REG;
@@ -797,8 +744,6 @@ int regno;
     supply_register (FPS_REGNUM, &val);
     supply_register (EXO_REGNUM, &val);
   }
-
-  DEXIT("mm_fetch_registerS()");
 }
 
 
@@ -819,7 +764,6 @@ int regno;
     return;
   }
 
-  DENTER("mm_store_registers()");
   result = 0;
 
   out_msg_buf->write_r_msg.code= WRITE_REQ;
@@ -930,8 +874,6 @@ int regno;
   }
  
   registers_changed ();
-  DEXIT("mm_store_registers()");
-  /* FIXME return result;  it is ignored by caller.  */
 }
 
 /*************************************************** REMOTE_PREPARE_TO_STORE */
@@ -982,7 +924,6 @@ mm_insert_breakpoint (addr, contents_cache)
      CORE_ADDR addr;
      char *contents_cache;
 {
-  DENTER("mm_insert_breakpoint()");
   out_msg_buf->bkpt_set_msg.code = BKPT_SET;
   out_msg_buf->bkpt_set_msg.length = 4*4;
   out_msg_buf->bkpt_set_msg.memory_space = I_MEM;
@@ -991,10 +932,8 @@ mm_insert_breakpoint (addr, contents_cache)
   out_msg_buf->bkpt_set_msg.bkpt_type = -1;    /* use illop for 29000 */
   msg_send_serial( out_msg_buf);
   if (expect_msg(BKPT_SET_ACK,in_msg_buf,1)) {
-       DEXIT("mm_insert_breakpoint() success");
        return 0;               /* Success */
   } else {
-       DEXIT("mm_insert_breakpoint() failure");
        return 1;               /* Failure */
   }
 }
@@ -1005,17 +944,14 @@ mm_remove_breakpoint (addr, contents_cache)
      CORE_ADDR addr;
      char *contents_cache;
 {
-  DENTER("mm_remove_breakpoint()");
   out_msg_buf->bkpt_rm_msg.code = BKPT_RM;
   out_msg_buf->bkpt_rm_msg.length = 4*3;
   out_msg_buf->bkpt_rm_msg.memory_space = I_MEM;
   out_msg_buf->bkpt_rm_msg.bkpt_addr = (ADDR32) addr;
   msg_send_serial( out_msg_buf);
   if (expect_msg(BKPT_RM_ACK,in_msg_buf,1)) {
-       DEXIT("mm_remove_breakpoint()");
        return 0;               /* Success */
   } else {
-       DEXIT("mm_remove_breakpoint()");
        return 1;               /* Failure */
   }
 }
@@ -1029,7 +965,6 @@ int     from_tty;
 {
        char    buf[4];
 
-       DENTER("mm_kill()");
 #if defined(KERNEL_DEBUGGING)
        /* We don't ever kill the kernel */
        if (from_tty) {
@@ -1053,7 +988,6 @@ int     from_tty;
        }
        pop_target();
 #endif 
-       DEXIT("mm_kill()");
 }
 
 
@@ -1100,7 +1034,6 @@ mm_write_inferior_memory (memaddr, myaddr, len)
 {
   int i,nwritten;
 
-  /* DENTER("mm_write_inferior_memory()"); */
   out_msg_buf->write_req_msg.code= WRITE_REQ;
   out_msg_buf->write_req_msg.memory_space = mm_memory_space(memaddr);  
 
@@ -1121,7 +1054,6 @@ mm_write_inferior_memory (memaddr, myaddr, len)
                break;  
        }
   }
-  /* DEXIT("mm_write_inferior_memory()"); */
   return(nwritten);
 }
 
@@ -1136,7 +1068,6 @@ mm_read_inferior_memory(memaddr, myaddr, len)
 {
   int i,nread;
 
-  /* DENTER("mm_read_inferior_memory()"); */
   out_msg_buf->read_req_msg.code= READ_REQ;
   out_msg_buf->read_req_msg.memory_space = mm_memory_space(memaddr);
 
@@ -1371,7 +1302,6 @@ fetch_register (regno)
      int regno;
 {
      int  result;
-  DENTER("mm_fetch_register()");
   out_msg_buf->read_req_msg.code= READ_REQ;
   out_msg_buf->read_req_msg.length = 4*3;
   out_msg_buf->read_req_msg.byte_count = 4;
@@ -1412,7 +1342,6 @@ fetch_register (regno)
   } else {
        result = -1;
   }
-  DEXIT("mm_fetch_register()");
   return result;
 }
 /*****************************************************************************/ 
@@ -1425,7 +1354,6 @@ store_register (regno)
 {
      int  result;
 
-  DENTER("store_register()");
   out_msg_buf->write_req_msg.code= WRITE_REQ;
   out_msg_buf->write_req_msg.length = 4*4;
   out_msg_buf->write_req_msg.byte_count = 4;
@@ -1472,7 +1400,6 @@ store_register (regno)
   } else {
        result = -1;
   }
-  DEXIT("store_register()");
   return result;
 }
 /****************************************************************************/
@@ -1612,13 +1539,11 @@ INT32   msgcode;                /* Msg code we expect */
 union msg_t *msg_buf;          /* Where to put  the message received */
 int    from_tty;               /* Print message on error if non-zero */
 {
-  /* DENTER("expect_msg()"); */
   int  retries=0;
   while(msg_recv_serial(msg_buf) && (retries++<MAX_RETRIES)); 
   if (retries >= MAX_RETRIES) {
        printf("Expected msg %s, ",msg_str(msgcode));
        printf("no message received!\n");
-        /* DEXIT("expect_msg() failure"); */
         return(0);             /* Failure */
   }
 
@@ -1629,10 +1554,8 @@ int      from_tty;               /* Print message on error if non-zero */
         if (msg_buf->generic_msg.code == ERROR) 
                printf("%s\n",error_msg_str(msg_buf->error_msg.error_code));
      }
-     /* DEXIT("expect_msg() failure"); */
      return(0);                        /* Failure */
   }
-  /* DEXIT("expect_msg() success"); */
   return(1);                   /* Success */
 }      
 /****************************************************************************/
index c54ef669d0a86a8c635e7904c8df78edbef76e3f..3f6dc788a80344cf8468d2a005c1024662824fba 100644 (file)
@@ -50,18 +50,7 @@ Foundation, Inc., 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 int stop_soon_quietly;           /* for wait_for_inferior */
 extern struct value *call_function_by_hand();
@@ -169,7 +158,6 @@ udi_create_inferior (execfile, args, env)
      char *args;
      char **env;
 {
-  DENTER("udi_create_inferior()");
 
   if (execfile)
   { if (prog_name != NULL)
@@ -196,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
@@ -242,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
@@ -379,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.");
@@ -402,8 +378,6 @@ udi_close (quitting)        /*FIXME: how is quitting used */
 #endif
 
   printf_filtered ("  Ending remote debugging\n");
-
-  DEXIT("udi_close()");
 } 
 
 /**************************************************************** UDI_ATACH */
@@ -421,7 +395,6 @@ udi_attach (args, from_tty)
   UDISizeT     Size = 4;
   UDICount     CountDone;
   UDIBool      HostEndian = 0;
-  DENTER("udi_attach()");
 
   if (udi_session_id < 0)
       error ("UDI connection not opened yet, use the 'target udi' command.\n");
@@ -429,15 +402,12 @@ udi_attach (args, from_tty)
   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.
@@ -448,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()");
 }
 
 
@@ -470,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);
@@ -481,8 +449,6 @@ udi_resume (step, sig)
   { if(UDIExecute())
       error ("UDIExecute() failed in udi_resume");
   }
-
-  DEXIT("udi_resume()");
 }
 
 /******************************************************************** UDI_WAIT
@@ -501,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:
@@ -619,7 +584,6 @@ exit:
 
   timeout = old_timeout;       /* Restore original timeout value */
   immediate_quit = old_immediate_quit;
-  DEXIT("udi_wait()");
   return 0;
 }
 
@@ -964,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) {
@@ -979,7 +942,6 @@ int     from_tty;
        }
        pop_target();
 #endif 
-       DEXIT("udi_kill()");
 }
 
 
@@ -1053,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;
 
@@ -1071,7 +1031,6 @@ udi_write_inferior_memory (memaddr, myaddr, len)
           From += CountDone;
        }
   }
-  /* DEXIT("udi_write_inferior_memory()"); */
   return(nwritten);
 }
 
@@ -1092,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;
 
@@ -1198,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)
@@ -1240,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");
index 39644f3ba1f6d85d9a78146a5bbe77e6c5c264eb..ddb6955c7a8d0f3f956108923aad7c732c32a74d 100644 (file)
@@ -1126,8 +1126,7 @@ vx_open (args, from_tty)
   clnt_freeres (pClient, xdr_ldtabl, &loadTable);
 }
 \f
-/* attach_command --
-   takes a task started up outside of gdb and ``attaches'' to it.
+/* Takes a task started up outside of gdb and ``attaches'' to it.
    This stops it cold in its tracks and allows us to start tracing it.  */
 
 static void
@@ -1141,8 +1140,6 @@ vx_attach (args, from_tty)
   Ptrace_return ptrace_out;
   int status;
 
-  dont_repeat();
-
   if (!args)
     error_no_arg ("process-id to attach");
 
@@ -1170,23 +1167,6 @@ vx_attach (args, from_tty)
   push_target (&vx_run_ops);
   inferior_pid = pid;
   vx_running = 0;
-
-  mark_breakpoints_out ();
-
-  /* Set up the "saved terminal modes" of the inferior
-     based on what modes we are starting it with.  */
-  target_terminal_init ();
-
-  /* Install inferior's terminal modes.  */
-  target_terminal_inferior ();
-
-  /* We will get a task spawn event immediately.  */
-  init_wait_for_inferior ();
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  wait_for_inferior ();
-  stop_soon_quietly = 0;
-  normal_stop ();
 }
 
 
index 3ed9f8b90cf5aeda0deb1c580c678bf42f04236f..4a680b16a2ff7d0cb42f697b8ada50ac42836c55 100644 (file)
@@ -80,6 +80,7 @@ struct target_ops
   int        (*to_lookup_symbol) PARAMS ((char *, CORE_ADDR *));
   void               (*to_create_inferior) PARAMS ((char *, char *, char **));
   void               (*to_mourn_inferior) PARAMS ((void));
+  int        (*to_can_run) PARAMS ((void));
   enum strata   to_stratum;
   struct target_ops
               *to_next;
@@ -128,7 +129,13 @@ extern struct target_ops   *current_target;
 #define        target_close(quitting)  \
        (*current_target->to_close) (quitting)
 
-/* Attaches to a process on the target side.  */
+/* Attaches to a process on the target side.  Arguments are as passed
+   to the `attach' command by the user.  This routine can be called
+   when the target is not on the target-stack, if the target_can_run
+   routine returns 1; in that case, it must push itself onto the stack.  
+   Upon exit, the target should be ready for normal operations, and
+   should be ready to deliver the status of the process immediately 
+   (without waiting) to an upcoming target_wait call.  */
 
 #define        target_attach(args, from_tty)   \
        (*current_target->to_attach) (args, from_tty)
@@ -299,6 +306,11 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 #define        target_mourn_inferior() \
        (*current_target->to_mourn_inferior) ()
 
+/* Does target have enough data to do a run or attach command? */
+
+#define target_can_run(t) \
+       ((t)->to_can_run) ()
+
 /* Pointer to next target in the chain, e.g. a core file and an exec file.  */
 
 #define        target_next \
@@ -394,4 +406,10 @@ memory_insert_breakpoint PARAMS ((CORE_ADDR, char *));
 void
 noprocess PARAMS ((void));
 
+void
+find_default_attach PARAMS ((char *, int));
+
+void
+find_default_create_inferior PARAMS ((char *, char *, char **));
+
 #endif /* !defined (TARGET_H) */