* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,
[deliverable/binutils-gdb.git] / gdb / target.c
index 10ff09cac12e458228e64a3da9a8439dac365f78..6abbd00e340328362b48e4266aa8cb57e2f291bd 100644 (file)
@@ -58,7 +58,7 @@ static void
 tcomplain PARAMS ((void));
 
 static int
-nomemory PARAMS ((CORE_ADDR, char *, int, int));
+nomemory PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *));
 
 static int
 return_zero PARAMS ((void));
@@ -154,7 +154,7 @@ add_target (t)
                    target_struct_allocsize * sizeof (*target_structs));
     }
   target_structs[target_struct_size++] = t;
-  cleanup_target (t);
+/*  cleanup_target (t);*/
 
   if (targetlist == NULL)
     add_prefix_cmd ("target", class_run, target_command,
@@ -176,11 +176,12 @@ ignore ()
 
 /* ARGSUSED */
 static int
-nomemory (memaddr, myaddr, len, write)
+nomemory (memaddr, myaddr, len, write, t)
      CORE_ADDR memaddr;
      char *myaddr;
      int len;
      int write;
+     struct target_ops *t;
 {
   errno = EIO;         /* Can't read/write this location */
   return 0;            /* No bytes handled */
@@ -419,7 +420,8 @@ push_target (t)
 
   /* We have removed all targets in our stratum, now add the new one.  */
 
-  tmp = xmalloc (sizeof (struct target_stack_item));
+  tmp = (struct target_stack_item *)
+    xmalloc (sizeof (struct target_stack_item));
   tmp->next = cur;
   tmp->target_ops = t;
 
@@ -443,7 +445,8 @@ unpush_target (t)
 {
   struct target_stack_item *cur, *prev;
 
-  t->to_close (0);             /* Let it clean up */
+  if (t->to_close)
+    t->to_close (0);           /* Let it clean up */
 
   /* Look for the specified target.  Note that we assume that a target
      can only occur once in the target stack. */
@@ -666,6 +669,8 @@ target_xfer_memory (memaddr, myaddr, len, write)
       for (item = target_stack; item; item = item->next)
        {
          t = item->target_ops;
+         if (!t->to_has_memory)
+           continue;
 
          res = t->to_xfer_memory (memaddr, myaddr, curlen, write, t);
          if (res > 0)
@@ -716,6 +721,9 @@ target_info (args, from_tty)
     {
       t = item->target_ops;
 
+      if (!t->to_has_memory)
+       continue;
+
       if ((int)(t->to_stratum) <= (int)dummy_stratum)
        continue;
       if (has_all_mem)
@@ -1348,7 +1356,7 @@ Shows the entire stack of targets currently in use (including the exec-file,\n\
 core-file, and process, if any), as well as the symbol file name.";
 
 void
-_initialize_targets ()
+initialize_targets ()
 {
   push_target (&dummy_target);
 
This page took 0.023334 seconds and 4 git commands to generate.