diff options
author | Paul Koning <paul_koning@dell.com> | 2015-10-16 14:52:29 -0400 |
---|---|---|
committer | Paul Koning <paul_koning@dell.com> | 2015-10-16 14:52:29 -0400 |
commit | 3101915abf7ce1188e58c811e8c8096fae441e3c (patch) | |
tree | fce67531528d3540eef3d1afd15b91059e17e15f | |
parent | 22855f3cab8948f5b4a0fdda9845ce47c8bafbc9 (diff) | |
download | gdb-3101915abf7ce1188e58c811e8c8096fae441e3c.zip gdb-3101915abf7ce1188e58c811e8c8096fae441e3c.tar.gz gdb-3101915abf7ce1188e58c811e8c8096fae441e3c.tar.bz2 |
convert exec target to to_xclose
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.
-rw-r--r-- | gdb/exec.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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; |