Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com)
[deliverable/binutils-gdb.git] / gdb / remote-udi.c
index 9615112c8e626df6062cf48d97acc5b7fb141039..b796e90003b85b87205847dfa684dacff9eb4518 100644 (file)
@@ -27,12 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  - 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.
+       with termio, only with sgtty.
  - Daniel Mann at AMD took the 3.95 adaptions above and replaced
        MiniMON interface with UDI-p interface.   */
  
@@ -57,7 +52,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 static int kiodebug;
 extern int stop_soon_quietly;           /* for wait_for_inferior */
 extern struct value *call_function_by_hand();
-static void udi_resume PARAMS ((int step, int sig));
+static void udi_resume PARAMS ((int pid, int step, int sig));
 static void udi_fetch_registers PARAMS ((int regno));
 static void udi_load PARAMS ((char *args, int from_tty));
 static void fetch_register PARAMS ((int regno));
@@ -81,7 +76,7 @@ char   CoffFileName[100] = "";
 #define TYPE_A29050     3
 static  char *processor_name[] = { "Unknown", "Am29000", "Am29030", "Am29050" };
 static  int processor_type=TYPE_UNKNOWN;
-#define FREEZE_MODE     (read_register(CPS_REGNUM) && 0x400)
+#define FREEZE_MODE     (read_register(CPS_REGNUM) & 0x400)
 #define USE_SHADOW_PC  ((processor_type == TYPE_A29050) && FREEZE_MODE) 
 
 #define LLOG_FILE "udi.log"
@@ -130,22 +125,6 @@ typedef    struct  bkpt_entry_str
 static bkpt_entry_t    bkpt_table[BKPT_TABLE_SIZE];
 extern char    dfe_errmsg[];           /* error string */
 
-/* Called when SIGALRM signal sent due to alarm() timeout.  */
-#ifndef HAVE_TERMIO
-
-volatile int n_alarms;
-
-static void
-udi_timer ()
-{
-#if 0
-  if (kiodebug)
-    printf ("udi_timer called\n");
-#endif
-  n_alarms++;
-}
-#endif /* HAVE_TERMIO */
-
 /* malloc'd name of the program on the remote system.  */
 static char *prog_name = NULL;
 
@@ -256,19 +235,6 @@ udi_open (name, from_tty)
 
   push_target (&udi_ops);
 
-#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)
-    error ("udi_open: siginterrupt() %s", safe_strerror(errno));
-#endif
-
-  /* Set up read timeout timer.  */
-  if ((void (*)) signal (SIGALRM, udi_timer) == (void (*)) -1)
-    error ("udi_open: signal() %s", safe_strerror(errno));
-#endif
-
 #if defined (LOG_FILE)
   log_file = fopen (LOG_FILE, "w");
   if (log_file == NULL)
@@ -405,8 +371,8 @@ udi_attach (args, from_tty)
       printf ("Attaching to remote program %s...\n", prog_name);
 
   UDIStop();
-  From.Space = 11;
-  From.Offset = UDI29KSpecialRegs;
+  From.Space = UDI29KSpecialRegs;
+  From.Offset = 11;
   if (err = 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);
@@ -437,8 +403,8 @@ udi_detach (args,from_tty)
 ** Tell the remote machine to resume.  */
 
 static void
-udi_resume (step, sig)
-     int step, sig;
+udi_resume (pid, step, sig)
+     int pid, step, sig;
 {
   UDIError tip_error;
   UDIUInt32 Steps = 1;
@@ -494,7 +460,7 @@ udi_wait (status)
        {
        case UDIStdoutReady:
          if (UDIGetStdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone))
-           error ("UDIGetStdin() failed in udi_wait");
+           error ("UDIGetStdout() failed in udi_wait");
          fwrite (sbuf, 1, CountDone, stdout);
          fflush(stdout);
          continue;
@@ -504,9 +470,13 @@ udi_wait (status)
          fflush(stderr);
          continue;
        case UDIStdinNeeded:
-         printf("DEBUG: stdin requested ... continue\n");
-         /*    UDIPutStdin(sbuf, (UDISizeT)i, &CountDone); */
+         scanf ("%s", sbuf);
+         i = strlen (sbuf);
+         UDIPutStdin (sbuf, (UDISizeT)i, &CountDone);
          continue;
+       case UDIRunning:
+         /* In spite of the fact that we told UDIWait to wait forever, it will
+            return spuriously sometimes.  */
        case UDIStdinModeX:
          continue;
        default:
@@ -575,14 +545,11 @@ udi_wait (status)
     case UDINotExecuting:
       WSETSTOP ((*status), SIGTERM);
       break;
-    case UDIRunning:
-      WSETSTOP ((*status), SIGILL);
-      break;
     case UDIStopped:
       WSETSTOP ((*status), SIGTSTP);
       break;
     case UDIWarned:
-      WSETSTOP ((*status), SIGLOST);
+      WSETSTOP ((*status), SIGURG);
       break;
     case UDIStepped:
     case UDIBreak:
@@ -1035,9 +1002,9 @@ download(load_arg_string, from_tty)
        {
          token++;
 
-         if (strcmp (token, "ms") == 0)
+         if (STREQ (token, "ms"))
            stack_sizes[1] = atol (strtok (NULL, " \t"));
-         else if (strcmp (token, "rs") == 0)
+         else if (STREQ (token, "rs"))
            stack_sizes[0] = atol (strtok (NULL, " \t"));
          else
            {
@@ -1094,13 +1061,13 @@ download(load_arg_string, from_tty)
          const char *section_name;
 
          section_name = bfd_get_section_name (pbfd, section);
-         if (strcmp (section_name, ".text") == 0 && !load_text)
+         if (STREQ (section_name, ".text") && !load_text)
            continue;
-         else if (strcmp (section_name, ".data") == 0 && !load_data)
+         else if (STREQ (section_name, ".data") && !load_data)
            continue;
-         else if (strcmp (section_name, ".bss") == 0 && !load_bss)
+         else if (STREQ (section_name, ".bss") && !load_bss)
            continue;
-         else if (strcmp (section_name, ".lit") == 0 && !load_lit)
+         else if (STREQ (section_name, ".lit") && !load_lit)
            continue;
 
          To.Offset = bfd_get_section_vma (pbfd, section);
@@ -1517,7 +1484,25 @@ int   QuietMode = 0;             /* used for debugging */
 static struct target_ops udi_ops = {
         "udi",
        "Remote UDI connected TIP",
-       "Remote debug an AMD 29k using UDI socket connection to TIP process",
+       "Remote debug an AMD 29k using UDI socket connection to TIP process.\n\
+Arguments are\n\
+`configuration-id AF_INET hostname port-number'\n\
+    To connect via the network, where hostname and port-number specify the\n\
+    host and port where you can connect via UDI.\n\
+    configuration-id is unused.\n\
+\n\
+`configuration-id AF_UNIX socket-name tip-program'\n\
+    To connect using a local connection to the \"tip.exe\" program which is\n\
+    supplied by AMD.  If socket-name specifies an AF_UNIX socket then the\n\
+    tip program must already be started; connect to it using that socket.\n\
+    If not, start up tip-program, which should be the name of the tip\n\
+    program.  If appropriate, the PATH environment variable is searched.\n\
+    configuration-id is unused.\n\
+\n\
+`configuration-id'\n\
+    Look up the configuration in ./udi_soc or /etc/udi_soc, which\n\
+    are files containing lines in the above formats.  configuration-id is\n\
+    used to pick which line of the file to use.",
         udi_open,
        udi_close,
         udi_attach,
This page took 0.026557 seconds and 4 git commands to generate.