diff options
author | Pedro Alves <palves@redhat.com> | 2018-05-11 19:10:14 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-05-11 19:12:21 +0100 |
commit | 1524450719d3867e10fc6a8dbc051b8dc7924898 (patch) | |
tree | 65e147c2934fb6b2eae72aaf309a71f032c3ea76 /gdb/ChangeLog | |
parent | 451953fa440aa0ade02b652159155fae689483a3 (diff) | |
download | gdb-1524450719d3867e10fc6a8dbc051b8dc7924898.zip gdb-1524450719d3867e10fc6a8dbc051b8dc7924898.tar.gz gdb-1524450719d3867e10fc6a8dbc051b8dc7924898.tar.bz2 |
Heap-allocate core_target instances
This gets rid of the core_ops global, and replaces it with
heap-allocated core_target instances. In practice, there will only be
one such instance, though that will change further ahead as more
pieces of multi-target support are merged.
Notice that this replaces one heap-allocated object for another, the
number of allocations is the same. Specifically, currently we
heap-allocate the 'core_data' object, which holds the core's section
table. With this patch, that object is made a field of the
core_target class, and no longer allocated separately.
Note that this bit:
- /* Looks semi-reasonable. Toss the old core file and work on the
- new. */
-
- unpush_target (&core_ops);
does not need a replacement, because by the time we get here, the
target_preopen call at the top of core_target_open has already
unpushed any previous target.
gdb/ChangeLog:
2018-05-11 Pedro Alves <palves@redhat.com>
* corelow.c (core_target) <core_target>: No longer inline.
Initialize m_core_gdbarch, m_core_vec and build the section table
here.
<~core_target>: New.
<core_gdbarch, get_core_register_section>: New methods.
<m_core_section_table, m_core_vec, m_core_gdbarch>: New fields,
factored out from ...
<core_data, core_vec, core_gdbarch>: ... these deleted globals.
(core_ops): Delete.
(sniff_core_bfd): Add gdbarch parameter.
(core_close): Delete, merged into ...
(core_target::close): ... here. Delete self.
(core_close_cleanup): Delete.
(core_target_open): Allocate a core_target on the heap. Use a
unique_ptr instead of a cleanup. Bits moved into the core_target
ctor. Adjust to use core_target methods instead of globals.
(get_core_register_section): Rename to ...
(core_target::get_core_register_section): ... this and adjust.
(struct get_core_registers_cb_data): New.
(get_core_registers_cb): Use it. Use bool.
(core_target::fetch_registers, core_target::files_info)
(core_target::xfer_partial, core_target::read_description)
(core_target::pid_to, core_target::thread_name): Adjust to
reference class fields instead of globals.
* target.h (struct target_ops_deleter, target_ops_up): New.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2641884..ce34e4f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,33 @@ 2018-05-11 Pedro Alves <palves@redhat.com> + * corelow.c (core_target) <core_target>: No longer inline. + Initialize m_core_gdbarch, m_core_vec and build the section table + here. + <~core_target>: New. + <core_gdbarch, get_core_register_section>: New methods. + <m_core_section_table, m_core_vec, m_core_gdbarch>: New fields, + factored out from ... + <core_data, core_vec, core_gdbarch>: ... these deleted globals. + (core_ops): Delete. + (sniff_core_bfd): Add gdbarch parameter. + (core_close): Delete, merged into ... + (core_target::close): ... here. Delete self. + (core_close_cleanup): Delete. + (core_target_open): Allocate a core_target on the heap. Use a + unique_ptr instead of a cleanup. Bits moved into the core_target + ctor. Adjust to use core_target methods instead of globals. + (get_core_register_section): Rename to ... + (core_target::get_core_register_section): ... this and adjust. + (struct get_core_registers_cb_data): New. + (get_core_registers_cb): Use it. Use bool. + (core_target::fetch_registers, core_target::files_info) + (core_target::xfer_partial, core_target::read_description) + (core_target::pid_to, core_target::thread_name): Adjust to + reference class fields instead of globals. + * target.h (struct target_ops_deleter, target_ops_up): New. + +2018-05-11 Pedro Alves <palves@redhat.com> + * corefile.c (core_file_command): Move to corelow.c. * corelow.c (the_core_target): Delete. (core_file_command): Moved from corefile.c. Check exec_bfd |