]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
convert exec target to to_xclose
authorPaul Koning <paul_koning@dell.com>
Fri, 16 Oct 2015 18:52:29 +0000 (14:52 -0400)
committerPaul Koning <paul_koning@dell.com>
Fri, 16 Oct 2015 18:52:29 +0000 (14:52 -0400)
This converts the exec target to use to_xclose, to make it suitable
for multi-target.

2014-07-29  Tom Tromey  <tromey@redhat.com>

* exec.c (exec_xclose_1): Rename from exec_close_1.  Free "self".
(add_target_sections): Push a new target instance.
(section_table_read_available_memory): Don't refer to "exec_ops".
(set_section_command): Likewise.
(init_exec_ops): Set to_xclose, not to_close.

gdb/exec.c

index 3089bb4f42a8bcdf5dd695d522e8f2e42a2a4796..a2b29424aa0370b9640028f1c648ce3f8f841c38 100644 (file)
@@ -105,11 +105,11 @@ exec_close (void)
     }
 }
 
-/* This is the target_close implementation.  Clears all target
+/* This is the target_xclose implementation.  Clears all target
    sections and closes all executable bfds from all program spaces.  */
 
 static void
-exec_close_1 (struct target_ops *self)
+exec_xclose_1 (struct target_ops *self)
 {
   struct program_space *ss;
   struct cleanup *old_chain;
@@ -123,6 +123,7 @@ exec_close_1 (struct target_ops *self)
   }
 
   do_cleanups (old_chain);
+  xfree (self);
 }
 
 void
@@ -512,7 +513,7 @@ add_target_sections (void *owner,
       /* If these are the first file sections we can provide memory
         from, push the file_stratum target.  */
       if (!target_is_pushed (&exec_ops))
-       push_target (&exec_ops);
+       push_target (TARGET_NEW (struct target_ops, &exec_ops));
     }
 }
 
@@ -706,7 +707,7 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
   mem_range_s *r;
   int i;
 
-  table = target_get_section_table (&exec_ops);
+  table = current_target_sections;
   available_memory = section_table_available_memory (available_memory,
                                                     offset, len,
                                                     table->sections,
@@ -962,7 +963,7 @@ set_section_command (char *args, int from_tty)
          p->addr += offset;
          p->endaddr += offset;
          if (from_tty)
-           exec_files_info (&exec_ops);
+           exec_files_info (NULL);
          return;
        }
     }
@@ -1031,7 +1032,7 @@ init_exec_ops (void)
   exec_ops.to_doc = "Use an executable file as a target.\n\
 Specify the filename of the executable file.";
   exec_ops.to_open = exec_open;
-  exec_ops.to_close = exec_close_1;
+  exec_ops.to_xclose = exec_xclose_1;
   exec_ops.to_xfer_partial = exec_xfer_partial;
   exec_ops.to_get_section_table = exec_get_section_table;
   exec_ops.to_files_info = exec_files_info;