remote: multiple remote_arch_state instances per arch
authorPedro Alves <palves@redhat.com>
Tue, 22 May 2018 17:22:08 +0000 (18:22 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 22 May 2018 17:32:12 +0000 (18:32 +0100)
commit9d6eea31325e4027b5f035e941864fa6d780a8ca
treea3b8b64c13a81397de6e43316963cc424306fc8c
parentdd194f6b36727987dc7f0d707512bd886982099c
remote: multiple remote_arch_state instances per arch

Currently, we associate gdbarch-related remote protocol state on a
per-gdbarch data object.  Things like the size of the g/G packet, and
the max remote packet size.  If we'll support being connected to
different remote servers at the same time, then we need to cope with
each having their own packet sizes, even if they are each debugging
programs of the same architecture.  I.e., a single instance of
remote_arch_state per arch is not sufficient.

This patch moves the remote_arch_state object to a map of
gdbarch-to-remote_arch_state saved in the remote_state structure.
Usually there will only be one entry in the map, though we may see
more with stubs that support multi-process and/or archs with multiple
ABIs (e.g, one remote_arch_state for 64-bit inferiors and another for
32-bit inferiors).

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c: Include <unordered_map>.
(remote_state): Now a class.
(remote_state) <get_remote_arch_state>: Declare method.
<get_remote_arch_state>: New field.
(remote_arch_state) <remote_arch_state>: Declare ctor.
<regs>: Now a unique_ptr.
(remote_gdbarch_data_handle): Delete.
(get_remote_arch_state): Delete.
(remote_state::get_remote_arch_state): New.
(get_remote_state): Adjust to call remote_state's
get_remote_arch_state method.
(init_remote_state): Delete, bits factored out to ...
(remote_arch_state::remote_arch_state): ... this new method.
(get_remote_packet_size, get_memory_packet_size)
(process_g_packet, remote_target::fetch_registers)
(remote_target::prepare_to_store, store_registers_using_G)
(remote_target::store_registers, remote_target::get_trace_status):
Adjust to call remote_state's method.
(_initialize_remote): Remove reference to
remote_gdbarch_data_handle.
gdb/ChangeLog
gdb/remote.c
This page took 0.03834 seconds and 4 git commands to generate.