This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Heap-allocate core_target instances
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Fri, 11 May 2018 17:30:24 -0400
- Subject: [binutils-gdb] Heap-allocate core_target instances
*** TEST RESULTS FOR COMMIT 1524450719d3867e10fc6a8dbc051b8dc7924898 ***
Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: 1524450719d3867e10fc6a8dbc051b8dc7924898
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.
- Follow-Ups:
- Failures on Fedora-s390x-m64, branch master
- Failures on RHEL-s390x-m64, branch master
- Failures on Debian-s390x-m64, branch master
- Failures on Debian-s390x-native-gdbserver-m64, branch master
- *** COMPILATION FAILED *** Failures on Fedora-i686, branch master *** BREAKAGE ***
- Failures on Fedora-x86_64-cc-with-index, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-native-gdbserver-m64, branch master
- *** COMPILATION FAILED *** Failures on Fedora-x86_64-w64-mingw32, branch master *** BREAKAGE ***
- Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, branch master