GNU Binutils with patches for OS216
修訂 | 3101915abf7ce1188e58c811e8c8096fae441e3c (tree) |
---|---|
時間 | 2015-10-17 03:52:29 |
作者 | Paul Koning <paul_koning@dell...> |
Commiter | Paul Koning |
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.
@@ -105,11 +105,11 @@ exec_close (void) | ||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | -/* This is the target_close implementation. Clears all target | |
108 | +/* This is the target_xclose implementation. Clears all target | |
109 | 109 | sections and closes all executable bfds from all program spaces. */ |
110 | 110 | |
111 | 111 | static void |
112 | -exec_close_1 (struct target_ops *self) | |
112 | +exec_xclose_1 (struct target_ops *self) | |
113 | 113 | { |
114 | 114 | struct program_space *ss; |
115 | 115 | struct cleanup *old_chain; |
@@ -123,6 +123,7 @@ exec_close_1 (struct target_ops *self) | ||
123 | 123 | } |
124 | 124 | |
125 | 125 | do_cleanups (old_chain); |
126 | + xfree (self); | |
126 | 127 | } |
127 | 128 | |
128 | 129 | void |
@@ -512,7 +513,7 @@ add_target_sections (void *owner, | ||
512 | 513 | /* If these are the first file sections we can provide memory |
513 | 514 | from, push the file_stratum target. */ |
514 | 515 | if (!target_is_pushed (&exec_ops)) |
515 | - push_target (&exec_ops); | |
516 | + push_target (TARGET_NEW (struct target_ops, &exec_ops)); | |
516 | 517 | } |
517 | 518 | } |
518 | 519 |
@@ -706,7 +707,7 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset, | ||
706 | 707 | mem_range_s *r; |
707 | 708 | int i; |
708 | 709 | |
709 | - table = target_get_section_table (&exec_ops); | |
710 | + table = current_target_sections; | |
710 | 711 | available_memory = section_table_available_memory (available_memory, |
711 | 712 | offset, len, |
712 | 713 | table->sections, |
@@ -962,7 +963,7 @@ set_section_command (char *args, int from_tty) | ||
962 | 963 | p->addr += offset; |
963 | 964 | p->endaddr += offset; |
964 | 965 | if (from_tty) |
965 | - exec_files_info (&exec_ops); | |
966 | + exec_files_info (NULL); | |
966 | 967 | return; |
967 | 968 | } |
968 | 969 | } |
@@ -1031,7 +1032,7 @@ init_exec_ops (void) | ||
1031 | 1032 | exec_ops.to_doc = "Use an executable file as a target.\n\ |
1032 | 1033 | Specify the filename of the executable file."; |
1033 | 1034 | exec_ops.to_open = exec_open; |
1034 | - exec_ops.to_close = exec_close_1; | |
1035 | + exec_ops.to_xclose = exec_xclose_1; | |
1035 | 1036 | exec_ops.to_xfer_partial = exec_xfer_partial; |
1036 | 1037 | exec_ops.to_get_section_table = exec_get_section_table; |
1037 | 1038 | exec_ops.to_files_info = exec_files_info; |