import gdb-1999-09-28 snapshot
[deliverable/binutils-gdb.git] / gdb / target.c
index d0b94829ac02d99ca79219ba2c09ae14450c1e27..01e01c2b82ef2469e542465807429e33d9975d83 100644 (file)
@@ -450,6 +450,9 @@ cleanup_target (t)
 
   de_fault (to_pid_to_exec_file, (char *(*)PARAMS ((int))) return_zero);
   de_fault (to_core_file_to_sym_file, (char *(*)PARAMS ((char *))) return_zero);
+  de_fault (to_can_async_p, (int (*) (void)) return_zero);
+  de_fault (to_is_async_p, (int (*) (void)) return_zero);
+  de_fault (to_async, (void (*) (void (*) (int, void*, int), void*)) tcomplain);
 #undef de_fault
 }
 
@@ -541,9 +544,11 @@ update_current_target ()
       INHERIT (to_has_registers, t);
       INHERIT (to_has_execution, t);
       INHERIT (to_has_thread_control, t);
-      INHERIT (to_has_async_exec, t);
       INHERIT (to_sections, t);
       INHERIT (to_sections_end, t);
+      INHERIT (to_can_async_p, t);
+      INHERIT (to_is_async_p, t);
+      INHERIT (to_async, t);
       INHERIT (to_magic, t);
 
 #undef INHERIT
@@ -1113,6 +1118,56 @@ return_one ()
   return 1;
 }
 
+/*
+ * Resize the to_sections pointer.  Also make sure that anyone that
+ * was holding on to an old value of it gets updated.
+ * Returns the old size.
+ */
+
+int
+target_resize_to_sections (struct target_ops *target, int num_added)
+{
+  struct target_ops **t;
+  struct section_table *old_value;
+  int old_count;
+
+  old_value = target->to_sections;
+
+  if (target->to_sections)
+    {
+      old_count = target->to_sections_end - target->to_sections;
+      target->to_sections = (struct section_table *)
+       xrealloc ((char *) target->to_sections,
+                 (sizeof (struct section_table)) * (num_added + old_count));
+    }
+  else
+    {
+      old_count = 0;
+      target->to_sections = (struct section_table *)
+       xmalloc ((sizeof (struct section_table)) * num_added);
+    }
+  target->to_sections_end = target->to_sections + (num_added + old_count);
+
+  /* Check to see if anyone else was pointing to this structure.
+     If old_value was null, then no one was. */
+     
+  if (old_value)
+    {
+      for (t = target_structs; t < target_structs + target_struct_size;
+          ++t)
+       {
+         if ((*t)->to_sections == old_value)
+           {
+             (*t)->to_sections = target->to_sections;
+             (*t)->to_sections_end = target->to_sections_end;
+           }
+       }
+    }
+  
+  return old_count;
+
+}
+
 /* Find a single runnable target in the stack and return it.  If for
    some reason there is more than one, return NULL.  */
 
@@ -1272,6 +1327,7 @@ static struct {
   {"SIG62", "Real-time event 62"},
   {"SIG63", "Real-time event 63"},
   {"SIGCANCEL", "LWP internal signal"},
+  {"SIG32", "Real-time event 32"},
 
 #if defined(MACH) || defined(__MACH__)
   /* Mach exceptions */
@@ -1571,8 +1627,16 @@ target_signal_from_host (hostsig)
 
 #if defined (REALTIME_LO)
   if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
-    return (enum target_signal)
-      (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
+    {
+      /* This block of TARGET_SIGNAL_REALTIME value is in order.  */
+      if (33 <= hostsig && hostsig <= 63)
+       return (enum target_signal)
+         (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
+      else if (hostsig == 32)
+       return TARGET_SIGNAL_REALTIME_32;
+      else
+       error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
+    }
 #endif
   return TARGET_SIGNAL_UNKNOWN;
 }
@@ -1771,6 +1835,8 @@ target_signal_to_host (oursig)
       return SIGPRIO;
 #endif
 
+    case TARGET_SIGNAL_REALTIME_32: return 32; /* by definition */ 
+
       /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
 #if defined (EXC_BAD_ACCESS) && defined (_NSIG)
     case TARGET_EXC_BAD_ACCESS:
@@ -1885,9 +1951,9 @@ normal_pid_to_str (pid)
   static char buf[30];
 
   if (STREQ (current_target.to_shortname, "remote"))
-    sprintf (buf, "thread %d\0", pid);
+    sprintf (buf, "thread %d", pid);
   else
-    sprintf (buf, "process %d\0", pid);
+    sprintf (buf, "process %d", pid);
 
   return buf;
 }
@@ -2086,9 +2152,9 @@ debug_to_fetch_registers (regno)
   fprintf_unfiltered (gdb_stdlog, "target_fetch_registers (%s)",
                      regno != -1 ? REGISTER_NAME (regno) : "-1");
   if (regno != -1)
-    fprintf_unfiltered (gdb_stdlog, " = 0x%x %d",
+    fprintf_unfiltered (gdb_stdlog, " = 0x%lx %ld",
                        (unsigned long) read_register (regno),
-                       read_register (regno));
+                       (unsigned long) read_register (regno));
   fprintf_unfiltered (gdb_stdlog, "\n");
 }
 
@@ -2099,7 +2165,7 @@ debug_to_store_registers (regno)
   debug_target.to_store_registers (regno);
 
   if (regno >= 0 && regno < NUM_REGS)
-    fprintf_unfiltered (gdb_stdlog, "target_store_registers (%s) = 0x%x %d\n",
+    fprintf_unfiltered (gdb_stdlog, "target_store_registers (%s) = 0x%lx %ld\n",
                        REGISTER_NAME (regno),
                        (unsigned long) read_register (regno),
                        (unsigned long) read_register (regno));
@@ -2171,8 +2237,9 @@ debug_to_insert_breakpoint (addr, save)
   retval = debug_target.to_insert_breakpoint (addr, save);
 
   fprintf_unfiltered (gdb_stdlog,
-                     "target_insert_breakpoint (0x%x, xxx) = %d\n",
-                     (unsigned long) addr, retval);
+                     "target_insert_breakpoint (0x%lx, xxx) = %ld\n",
+                     (unsigned long) addr,
+                     (unsigned long) retval);
   return retval;
 }
 
@@ -2186,8 +2253,9 @@ debug_to_remove_breakpoint (addr, save)
   retval = debug_target.to_remove_breakpoint (addr, save);
 
   fprintf_unfiltered (gdb_stdlog,
-                     "target_remove_breakpoint (0x%x, xxx) = %d\n",
-                     (unsigned long) addr, retval);
+                     "target_remove_breakpoint (0x%lx, xxx) = %ld\n",
+                     (unsigned long) addr,
+                     (unsigned long) retval);
   return retval;
 }
 
This page took 0.039532 seconds and 4 git commands to generate.