Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Process record and replay target for GDB, the GNU debugger.
|
|
|
|
|
2020-01-01 07:20:01 +01:00
|
|
|
Copyright (C) 2013-2020 Free Software Foundation, Inc.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
#include "gdbthread.h"
|
Use thread_info and inferior pointers more throughout
This is more preparation bits for multi-target support.
In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID. E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines. Or maybe we've loaded multiple
instances of the same core file. Etc.
To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively. I.e.,
each process_stratum instance has its own thread/process number space.
As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int. E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.
In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid. Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.
So that's what this patch does. In a bit more detail:
- Changes a number of functions and methods to take a thread_info or
inferior pointer instead of a ptid_t or int parameter.
- Changes a number of structure fields from ptid_t/int to inferior or
thread_info pointers.
- Uses the inferior_thread() function whenever possible instead of
inferior_ptid.
- Uses thread_info pointers directly when possible instead of the
is_running/is_stopped etc. routines that require a lookup.
- A number of functions are eliminated along the way, such as:
int valid_gdb_inferior_id (int num);
int pid_to_gdb_inferior_id (int pid);
int gdb_inferior_id_to_pid (int num);
int in_inferior_list (int pid);
- A few structures and places hold a thread_info pointer across
inferior execution, so now they take a strong reference to the
(refcounted) thread_info object to avoid the thread_info pointer
getting stale. This is done in enable_thread_stack_temporaries and
in the infcall.c code.
- Related, there's a spot in infcall.c where using a RAII object to
handle the refcount would be handy, so a gdb::ref_ptr specialization
for thread_info is added (thread_info_ref, in gdbthread.h), along
with a gdb_ref_ptr policy that works for all refcounted_object types
(in common/refcounted-object.h).
gdb/ChangeLog:
2018-06-21 Pedro Alves <palves@redhat.com>
* ada-lang.h (ada_get_task_number): Take a thread_info pointer
instead of a ptid_t. All callers adjusted.
* ada-tasks.c (ada_get_task_number): Likewise. All callers
adjusted.
(print_ada_task_info, display_current_task_id, task_command_1):
Adjust.
* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
inferior_thread.
(breakpoint_kind): Adjust.
(remove_breakpoints_pid): Rename to ...
(remove_breakpoints_inf): ... this. Adjust to take an inferior
pointer. All callers adjusted.
(bpstat_clear_actions): Use inferior_thread.
(get_bpstat_thread): New.
(bpstat_do_actions): Use it.
(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
to take a thread_info pointer. All callers adjusted.
(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
(breakpoint_re_set_thread): Use inferior_thread.
* breakpoint.h (struct inferior): Forward declare.
(bpstat_stop_status): Update.
(remove_breakpoints_pid): Delete.
(remove_breakpoints_inf): New.
* bsd-uthread.c (bsd_uthread_target::wait)
(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd): Adjust.
(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
inferior_thread.
* cli/cli-interp.c: Include "inferior.h".
* common/refcounted-object.h (struct
refcounted_object_ref_policy): New.
* compile/compile-object-load.c: Include gdbthread.h.
(store_regs): Use inferior_thread.
* corelow.c (core_target::close): Use current_inferior.
(core_target_open): Adjust to use first_thread_of_inferior and use
the current inferior.
* ctf.c (ctf_target::close): Adjust to use current_inferior.
* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
Take a thread_info pointer instead of a ptid_t.
* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
(dummy_frame_discard, register_dummy_frame_dtor): Take a
thread_info pointer instead of a ptid_t.
* elfread.c: Include "inferior.h".
(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
Use inferior_thread.
* eval.c (evaluate_subexp): Likewise.
* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
inferior_thread.
* gdb_proc_service.h (struct thread_info): Forward declare.
(struct ps_prochandle) <ptid>: Delete, replaced by ...
<thread>: ... this new field. All references adjusted.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
'thread' parameter. All implementations and callers adjusted.
* gdbthread.h (thread_info) <set_running>: New method.
(delete_thread, delete_thread_silent): Take a thread_info pointer
instead of a ptid.
(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_live_thread_of_process): Delete, replaced by ...
(any_live_thread_of_inferior): ... this new function. All callers
adjusted.
(switch_to_thread, switch_to_no_thread): Declare.
(is_executing): Delete.
(enable_thread_stack_temporaries): Update comment.
<enable_thread_stack_temporaries>: Take a thread_info pointer
instead of a ptid_t. Incref the thread.
<~enable_thread_stack_temporaries>: Decref the thread.
<m_ptid>: Delete
<m_thr>: New.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Take a thread_info pointer instead of a ptid_t. All callers
adjusted.
* infcall.c (get_call_return_value): Use inferior_thread.
(run_inferior_call): Work with thread pointers instead of ptid_t.
(call_function_by_hand_dummy): Work with thread pointers instead
of ptid_t. Use thread_info_ref.
* infcmd.c (proceed_thread_callback): Access thread's state
directly.
(ensure_valid_thread, ensure_not_running): Use inferior_thread,
access thread's state directly.
(continue_command): Use inferior_thread.
(info_program_command): Use find_thread_ptid and access thread
state directly.
(proceed_after_attach_callback): Use thread state directly.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(exit_inferior): Take an inferior pointer instead of a pid. All
callers adjusted.
(exit_inferior_silent): New.
(detach_inferior): Delete.
(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
(gdb_inferior_id_to_pid, in_inferior_list): Delete.
(detach_inferior_command, kill_inferior_command): Use
find_inferior_id instead of valid_gdb_inferior_id and
gdb_inferior_id_to_pid.
(inferior_command): Use inferior and thread pointers.
* inferior.h (struct thread_info): Forward declare.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t. All callers adjusted.
(detach_inferior): Delete declaration.
(exit_inferior, exit_inferior_silent): Take an inferior pointer
instead of a pid. All callers adjusted.
(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
(valid_gdb_inferior_id): Delete.
* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
(struct displaced_step_inferior_state) <pid>: Delete, replaced by
...
<inf>: ... this new field.
<step_ptid>: Delete, replaced by ...
<step_thread>: ... this new field.
(get_displaced_stepping_state): Take an inferior pointer instead
of a pid. All callers adjusted.
(displaced_step_in_progress_any_inferior): Adjust.
(displaced_step_in_progress_thread): Take a thread pointer instead
of a ptid_t. All callers adjusted.
(displaced_step_in_progress, add_displaced_stepping_state): Take
an inferior pointer instead of a pid. All callers adjusted.
(get_displaced_step_closure_by_addr): Adjust.
(remove_displaced_stepping_state): Take an inferior pointer
instead of a pid. All callers adjusted.
(displaced_step_prepare_throw, displaced_step_prepare)
(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
All callers adjusted.
(start_step_over): Adjust.
(infrun_thread_ptid_changed): Remove bit updating ptids in the
displaced step queue.
(do_target_resume): Adjust.
(fetch_inferior_event): Use inferior_thread.
(context_switch, get_inferior_stop_soon): Take an
execution_control_state pointer instead of a ptid_t. All callers
adjusted.
(switch_to_thread_cleanup): Delete.
(stop_all_threads): Use scoped_restore_current_thread.
* inline-frame.c: Include "gdbthread.h".
(inline_state) <inline_state>: Take a thread pointer instead of a
ptid_t. All callers adjusted.
<ptid>: Delete, replaced by ...
<thread>: ... this new field.
(find_inline_frame_state): Take a thread pointer instead of a
ptid_t. All callers adjusted.
(skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Take a thread
pointer instead of a ptid_t. All callers adjusted.
* inline-frame.h (skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Likewise.
* linux-fork.c (delete_checkpoint_command): Adjust to use thread
pointers directly.
* linux-nat.c (get_detach_signal): Likewise.
* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
(thread_db_notice_clone): Adjust.
(thread_db_find_new_threads_silently)
(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
a thread pointer instead of a ptid_t. All callers adjusted.
* mi/mi-cmd-var.c: Include "inferior.h".
(mi_cmd_var_update_iter): Update to use thread pointers.
* mi/mi-interp.c (mi_new_thread): Update to use the thread's
inferior directly.
(mi_output_running_pid, mi_inferior_count): Delete, bits factored
out to ...
(mi_output_running): ... this new function.
(mi_on_resume_1): Adjust to use it.
(mi_user_selected_context_changed): Adjust to use inferior_thread.
* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
directly.
(interrupt_thread_callback): : Adjust to use thread and inferior
pointers.
* proc-service.c: Include "gdbthread.h".
(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
* progspace-and-thread.c: Include "inferior.h".
* progspace.c: Include "inferior.h".
* python/py-exitedevent.c (create_exited_event_object): Adjust to
hold a reference to an inferior_object.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
inferior_thread.
* python/py-inferior.c (struct inferior_object): Give the type a
tag name instead of a typedef.
(python_on_normal_stop): No need to check if the current thread is
listed.
(inferior_to_inferior_object): Change return type to
inferior_object. All callers adjusted.
(find_thread_object): Delete, bits factored out to ...
(thread_to_thread_object): ... this new function.
* python/py-infthread.c (create_thread_object): Use
inferior_to_inferior_object.
(thpy_is_stopped): Use thread pointer directly.
(gdbpy_selected_thread): Use inferior_thread.
* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(btpy_insn_or_gap_new): Drop const.
(btpy_list_new): Take a thread pointer instead of a ptid_t. All
callers adjusted.
* python/py-record.c: Include "gdbthread.h".
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
(gdbpy_current_recording): Use inferior_thread.
* python/py-record.h (recpy_record_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_element_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field. All users adjusted.
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t. All callers adjusted.
* python/py-threadevent.c: Include "gdbthread.h".
(get_event_thread): Use thread_to_thread_object.
* python/python-internal.h (struct inferior_object): Forward
declare.
(find_thread_object, find_inferior_object): Delete declarations.
(thread_to_thread_object, inferior_to_inferior_object): New
declarations.
* record-btrace.c: Include "inferior.h".
(require_btrace_thread): Use inferior_thread.
(record_btrace_frame_sniffer)
(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
(get_thread_current_frame): Use scoped_restore_current_thread and
switch_to_thread.
(get_thread_current_frame): Use thread pointer directly.
(record_btrace_replay_at_breakpoint): Use thread's inferior
pointer directly.
* record-full.c: Include "inferior.h".
* regcache.c: Include "gdbthread.h".
(get_thread_arch_regcache): Use the inferior's address space
directly.
(get_thread_regcache, registers_changed_thread): New.
* regcache.h (get_thread_regcache(thread_info *thread)): New
overload.
(registers_changed_thread): New.
(remote_target) <remote_detach_1>: Swap order of parameters.
(remote_add_thread): <remote_add_thread>: Return the new thread.
(get_remote_thread_info(ptid_t)): New overload.
(remote_target::remote_notice_new_inferior): Use thread pointers
directly.
(remote_target::process_initial_stop_replies): Use
thread_info::set_running.
(remote_target::remote_detach_1, remote_target::detach)
(extended_remote_target::detach): Adjust.
* stack.c (frame_show_address): Use inferior_thread.
* target-debug.h (target_debug_print_thread_info_pp): New.
* target-delegates.c: Regenerate.
* target.c (default_thread_address_space): Delete.
(memory_xfer_partial_1): Use current_inferior.
(target_detach): Use current_inferior.
(target_thread_address_space): Delete.
(generic_mourn_inferior): Use current_inferior.
* target.h (struct target_ops) <thread_address_space>: Delete.
(target_thread_address_space): Delete.
* thread.c (init_thread_list): Use ALL_THREADS_SAFE. Use thread
pointers directly.
(delete_thread_1, delete_thread, delete_thread_silent): Take a
thread pointer instead of a ptid_t. Adjust all callers.
(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function. All callers
adjusted.
(any_thread_of_process): Rename to ...
(any_thread_of_inferior): ... this, and take an inferior pointer.
(any_live_thread_of_process): Rename to ...
(any_live_thread_of_inferior): ... this, and take an inferior
pointer.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Take a thread pointer instead
of a ptid_t. Adjust all callers.
(thread_info::set_running): New.
(validate_registers_access): Use inferior_thread.
(can_access_registers_ptid): Rename to ...
(can_access_registers_thread): ... this, and take a thread
pointer.
(print_thread_info_1): Adjust to compare thread pointers instead
of ptids.
(switch_to_no_thread, switch_to_thread): Make extern.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Use m_thread pointer directly.
(scoped_restore_current_thread::scoped_restore_current_thread):
Use inferior_thread.
(thread_command): Use thread pointer directly.
(thread_num_make_value_helper): Use inferior_thread.
* top.c (execute_command): Use inferior_thread.
* tui/tui-interp.c: Include "inferior.h".
* varobj.c (varobj_create): Use inferior_thread.
(value_of_root_1): Use find_thread_global_id instead of
global_thread_id_to_ptid.
2018-06-21 18:09:31 +02:00
|
|
|
#include "inferior.h"
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
#include "event-top.h"
|
|
|
|
#include "completer.h"
|
|
|
|
#include "arch-utils.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "exec.h"
|
|
|
|
#include "record.h"
|
|
|
|
#include "record-full.h"
|
|
|
|
#include "elf-bfd.h"
|
|
|
|
#include "gcore.h"
|
2020-04-13 20:42:59 +02:00
|
|
|
#include "gdbsupport/event-loop.h"
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
#include "inf-loop.h"
|
|
|
|
#include "gdb_bfd.h"
|
Convert observers to C++
This converts observers from using a special source-generating script
to be plain C++. This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).
Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.
Regression tested on the buildbot.
gdb/ChangeLog
2018-03-19 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* unittests/observable-selftests.c: New file.
* common/observable.h: New file.
* observable.h: New file.
* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
python/py-breakpoint.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
tui/tui-interp.c, valops.c: Update all users.
* tui/tui-hooks.c (tui_bp_created_observer)
(tui_bp_deleted_observer, tui_bp_modified_observer)
(tui_inferior_exit_observer, tui_before_prompt_observer)
(tui_normal_stop_observer, tui_register_changed_observer):
Remove.
(tui_observers_token): New global.
(attach_or_detach, tui_attach_detach_observers): New functions.
(tui_install_hooks, tui_remove_hooks): Use
tui_attach_detach_observers.
* record-btrace.c (record_btrace_thread_observer): Remove.
(record_btrace_thread_observer_token): New global.
* observer.sh: Remove.
* observer.c: Rename to observable.c.
* observable.c (namespace gdb_observers): Define new objects.
(observer_debug): Move into gdb_observers namespace.
(struct observer, struct observer_list, xalloc_observer_list_node)
(xfree_observer_list_node, generic_observer_attach)
(generic_observer_detach, generic_observer_notify): Remove.
(_initialize_observer): Update.
Don't include observer.inc.
* Makefile.in (generated_files): Remove observer.h, observer.inc.
(clean mostlyclean): Likewise.
(observer.h, observer.inc): Remove targets.
(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
(COMMON_SFILES): Use observable.c, not observer.c.
* .gitignore: Remove observer.h.
gdb/doc/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* observer.texi: Remove.
gdb/testsuite/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
|
|
|
#include "observable.h"
|
Add new infrun.h header.
Move infrun.c declarations out of inferior.h to a new infrun.h file.
Tested by building on:
i686-w64-mingw32, enable-targets=all
x86_64-linux, enable-targets=all
i586-pc-msdosdjgpp
And also grepped the whole tree for each symbol moved to find where
infrun.h might be necessary.
gdb/
2014-05-22 Pedro Alves <palves@redhat.com>
* inferior.h (debug_infrun, debug_displaced, stop_on_solib_events)
(sync_execution, sched_multi, step_stop_if_no_debug, non_stop)
(disable_randomization, enum exec_direction_kind)
(execution_direction, stop_registers, start_remote)
(clear_proceed_status, proceed, resume, user_visible_resume_ptid)
(wait_for_inferior, normal_stop, get_last_target_status)
(prepare_for_detach, fetch_inferior_event, init_wait_for_inferior)
(insert_step_resume_breakpoint_at_sal)
(follow_inferior_reset_breakpoints, stepping_past_instruction_at)
(set_step_info, print_stop_event, signal_stop_state)
(signal_print_state, signal_pass_state, signal_stop_update)
(signal_print_update, signal_pass_update)
(update_signals_program_target, clear_exit_convenience_vars)
(displaced_step_dump_bytes, update_observer_mode)
(signal_catch_update, gdb_signal_from_command): Move
declarations ...
* infrun.h: ... to this new file.
* amd64-tdep.c: Include infrun.h.
* annotate.c: Include infrun.h.
* arch-utils.c: Include infrun.h.
* arm-linux-tdep.c: Include infrun.h.
* arm-tdep.c: Include infrun.h.
* break-catch-sig.c: Include infrun.h.
* breakpoint.c: Include infrun.h.
* common/agent.c: Include infrun.h instead of inferior.h.
* corelow.c: Include infrun.h.
* event-top.c: Include infrun.h.
* go32-nat.c: Include infrun.h.
* i386-tdep.c: Include infrun.h.
* inf-loop.c: Include infrun.h.
* infcall.c: Include infrun.h.
* infcmd.c: Include infrun.h.
* infrun.c: Include infrun.h.
* linux-fork.c: Include infrun.h.
* linux-nat.c: Include infrun.h.
* linux-thread-db.c: Include infrun.h.
* monitor.c: Include infrun.h.
* nto-tdep.c: Include infrun.h.
* procfs.c: Include infrun.h.
* record-btrace.c: Include infrun.h.
* record-full.c: Include infrun.h.
* remote-m32r-sdi.c: Include infrun.h.
* remote-mips.c: Include infrun.h.
* remote-notif.c: Include infrun.h.
* remote-sim.c: Include infrun.h.
* remote.c: Include infrun.h.
* reverse.c: Include infrun.h.
* rs6000-tdep.c: Include infrun.h.
* s390-linux-tdep.c: Include infrun.h.
* solib-irix.c: Include infrun.h.
* solib-osf.c: Include infrun.h.
* solib-svr4.c: Include infrun.h.
* target.c: Include infrun.h.
* top.c: Include infrun.h.
* windows-nat.c: Include infrun.h.
* mi/mi-interp.c: Include infrun.h.
* mi/mi-main.c: Include infrun.h.
* python/py-threadevent.c: Include infrun.h.
2014-05-22 13:29:11 +02:00
|
|
|
#include "infrun.h"
|
Rename common to gdbsupport
This is the next patch in the ongoing series to move gdbsever to the
top level.
This patch just renames the "common" directory. The idea is to do
this move in two parts: first rename the directory (this patch), then
move the directory to the top. This approach makes the patches a bit
more tractable.
I chose the name "gdbsupport" for the directory. However, as this
patch was largely written by sed, we could pick a new name without too
much difficulty.
Tested by the buildbot.
gdb/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* contrib/ari/gdb_ari.sh: Change common to gdbsupport.
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* gdbsupport: Rename from common.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES)
(HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to
gdbsupport.
* aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c,
amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c,
amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c,
amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c,
amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c,
arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c,
arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c,
arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c,
arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c,
auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h,
btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c,
charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c,
cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c,
coff-pe-read.c, command.h, compile/compile-c-support.c,
compile/compile-c.h, compile/compile-cplus-symbols.c,
compile/compile-cplus-types.c, compile/compile-cplus.h,
compile/compile-loc2c.c, compile/compile.c, completer.c,
completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c,
cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c,
darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c,
disasm.h, dtrace-probe.c, dwarf-index-cache.c,
dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c,
dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c,
event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c,
features/aarch64-core.c, features/aarch64-fpu.c,
features/aarch64-pauth.c, features/aarch64-sve.c,
features/i386/32bit-avx.c, features/i386/32bit-avx512.c,
features/i386/32bit-core.c, features/i386/32bit-linux.c,
features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c,
features/i386/32bit-segments.c, features/i386/32bit-sse.c,
features/i386/64bit-avx.c, features/i386/64bit-avx512.c,
features/i386/64bit-core.c, features/i386/64bit-linux.c,
features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c,
features/i386/64bit-segments.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/riscv/32bit-cpu.c,
features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c,
features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c,
features/riscv/64bit-fpu.c, features/tic6x-c6xp.c,
features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h,
findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h,
gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c,
gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c,
go32-nat.c, guile/guile.c, guile/scm-ports.c,
guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c,
i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c,
i386-linux-tdep.c, i386-tdep.c, i387-tdep.c,
ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c,
inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h,
inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h,
inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, location.c, machoread.c,
macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h,
mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c,
mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h,
minsyms.c, mips-linux-tdep.c, namespace.h,
nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h,
nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c,
nat/amd64-linux-siginfo.c, nat/fork-inferior.c,
nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c,
nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c,
nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h,
nat/linux-waitpid.c, nat/mips-linux-watch.c,
nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c,
nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c,
nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h,
obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c,
parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c,
procfs.c, producer.c, progspace.h, psymtab.h,
python/py-framefilter.c, python/py-inferior.c, python/py-ref.h,
python/py-type.c, python/python.c, record-btrace.c, record-full.c,
record.c, record.h, regcache-dump.c, regcache.c, regcache.h,
remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c,
riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c,
selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c,
ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c,
source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c,
stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h,
symtab.c, symtab.h, target-descriptions.c, target-descriptions.h,
target-memory.c, target.c, target.h, target/waitstatus.c,
target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c,
top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c,
tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h,
unittests/array-view-selftests.c,
unittests/child-path-selftests.c, unittests/cli-utils-selftests.c,
unittests/common-utils-selftests.c,
unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c,
unittests/format_pieces-selftests.c,
unittests/function-view-selftests.c,
unittests/lookup_name_info-selftests.c,
unittests/memory-map-selftests.c, unittests/memrange-selftests.c,
unittests/mkdir-recursive-selftests.c,
unittests/observable-selftests.c,
unittests/offset-type-selftests.c, unittests/optional-selftests.c,
unittests/parse-connection-spec-selftests.c,
unittests/ptid-selftests.c, unittests/rsp-low-selftests.c,
unittests/scoped_fd-selftests.c,
unittests/scoped_mmap-selftests.c,
unittests/scoped_restore-selftests.c,
unittests/string_view-selftests.c, unittests/style-selftests.c,
unittests/tracepoint-selftests.c, unittests/unpack-selftests.c,
unittests/utils-selftests.c, unittests/xml-utils-selftests.c,
utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c,
value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c,
xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c,
xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport.
gdb/gdbserver/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS)
(version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change
common to gdbsupport.
* ax.c, event-loop.c, fork-child.c, gdb_proc_service.h,
gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c,
inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c,
linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c,
linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c,
linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h,
nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c,
server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h,
thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change
common to gdbsupport.
2019-05-06 04:29:24 +02:00
|
|
|
#include "gdbsupport/gdb_unlinker.h"
|
|
|
|
#include "gdbsupport/byte-vector.h"
|
2020-04-13 20:42:59 +02:00
|
|
|
#include "async-event.h"
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
/* This module implements "target record-full", also known as "process
|
|
|
|
record and replay". This target sits on top of a "normal" target
|
|
|
|
(a target that "has execution"), and provides a record and replay
|
|
|
|
functionality, including reverse debugging.
|
|
|
|
|
|
|
|
Target record has two modes: recording, and replaying.
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
In record mode, we intercept the resume and wait methods.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
Whenever gdb resumes the target, we run the target in single step
|
|
|
|
mode, and we build up an execution log in which, for each executed
|
|
|
|
instruction, we record all changes in memory and register state.
|
|
|
|
This is invisible to the user, to whom it just looks like an
|
2019-10-26 09:55:32 +02:00
|
|
|
ordinary debugging session (except for performance degradation).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
In replay mode, instead of actually letting the inferior run as a
|
|
|
|
process, we simulate its execution by playing back the recorded
|
|
|
|
execution log. For each instruction in the log, we simulate the
|
|
|
|
instruction's side effects by duplicating the changes that it would
|
|
|
|
have made on memory and registers. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
#define DEFAULT_RECORD_FULL_INSN_MAX_NUM 200000
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
#define RECORD_FULL_IS_REPLAY \
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
(record_full_list->next || ::execution_direction == EXEC_REVERSE)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
#define RECORD_FULL_FILE_MAGIC netorder32(0x20091016)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* These are the core structs of the process record functionality.
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
A record_full_entry is a record of the value change of a register
|
|
|
|
("record_full_reg") or a part of memory ("record_full_mem"). And each
|
|
|
|
instruction must have a struct record_full_entry ("record_full_end")
|
|
|
|
that indicates that this is the last struct record_full_entry of this
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
instruction.
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
Each struct record_full_entry is linked to "record_full_list" by "prev"
|
|
|
|
and "next" pointers. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_mem_entry
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
CORE_ADDR addr;
|
|
|
|
int len;
|
|
|
|
/* Set this flag if target memory for this entry
|
|
|
|
can no longer be accessed. */
|
|
|
|
int mem_entry_not_accessible;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
gdb_byte *ptr;
|
|
|
|
gdb_byte buf[sizeof (gdb_byte *)];
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_reg_entry
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
unsigned short num;
|
|
|
|
unsigned short len;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
gdb_byte *ptr;
|
|
|
|
gdb_byte buf[2 * sizeof (gdb_byte *)];
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_end_entry
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
enum gdb_signal sigval;
|
|
|
|
ULONGEST insn_num;
|
|
|
|
};
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
enum record_full_type
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_end = 0,
|
|
|
|
record_full_reg,
|
|
|
|
record_full_mem
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This is the data structure that makes up the execution log.
|
|
|
|
|
|
|
|
The execution log consists of a single linked list of entries
|
2013-03-11 09:44:14 +01:00
|
|
|
of type "struct record_full_entry". It is doubly linked so that it
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
can be traversed in either direction.
|
|
|
|
|
|
|
|
The start of the list is anchored by a struct called
|
2013-03-11 09:44:14 +01:00
|
|
|
"record_full_first". The pointer "record_full_list" either points
|
|
|
|
to the last entry that was added to the list (in record mode), or to
|
|
|
|
the next entry in the list that will be executed (in replay mode).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
Each list element (struct record_full_entry), in addition to next
|
|
|
|
and prev pointers, consists of a union of three entry types: mem,
|
|
|
|
reg, and end. A field called "type" determines which entry type is
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
represented by a given list element.
|
|
|
|
|
|
|
|
Each instruction that is added to the execution log is represented
|
|
|
|
by a variable number of list elements ('entries'). The instruction
|
|
|
|
will have one "reg" entry for each register that is changed by
|
|
|
|
executing the instruction (including the PC in every case). It
|
|
|
|
will also have one "mem" entry for each memory change. Finally,
|
|
|
|
each instruction will have an "end" entry that separates it from
|
|
|
|
the changes associated with the next instruction. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *prev;
|
|
|
|
struct record_full_entry *next;
|
|
|
|
enum record_full_type type;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
union
|
|
|
|
{
|
|
|
|
/* reg */
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_reg_entry reg;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* mem */
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_mem_entry mem;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* end */
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_end_entry end;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* If true, query if PREC cannot record memory
|
|
|
|
change of next instruction. */
|
Change boolean options to bool instead of int
This is for add_setshow_boolean_cmd as well as the gdb::option interface.
gdb/ChangeLog:
2019-09-17 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
(print_signatures): Likewise.
(trust_pad_over_xvs): Likewise.
* arch/aarch64-insn.c (aarch64_debug): Likewise.
* arch/aarch64-insn.h (aarch64_debug): Likewise.
* arm-linux-nat.c (arm_apcs_32): Likewise.
* arm-linux-tdep.c (arm_apcs_32): Likewise.
* arm-nbsd-nat.c (arm_apcs_32): Likewise.
* arm-tdep.c (arm_debug): Likewise.
(arm_apcs_32): Likewise.
* auto-load.c (debug_auto_load): Likewise.
(auto_load_gdb_scripts): Likewise.
(global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* auto-load.h (global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* breakpoint.c (disconnected_dprintf): Likewise.
(breakpoint_proceeded): Likewise.
(automatic_hardware_breakpoints): Likewise.
(always_inserted_mode): Likewise.
(target_exact_watchpoints): Likewise.
(_initialize_breakpoint): Update.
* breakpoint.h (target_exact_watchpoints): Change to bool.
* btrace.c (maint_btrace_pt_skip_pad): Likewise.
* cli/cli-cmds.c (trace_commands): Likewise.
* cli/cli-cmds.h (trace_commands): Likewise.
* cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument
to bool*.
* cli/cli-logging.c (logging_overwrite): Change to bool.
(logging_redirect): Likewise.
(debug_redirect): Likewise.
* cli/cli-option.h (option_def) <boolean>: Change return type to bool*.
(struct boolean_option_def) <get_var_address_cb_>: Change return type
to bool.
<boolean_option_def>: Update.
(struct flag_option_def): Change default type of Context to bool
from int.
<flag_option_def>: Change return type of var_address_cb_ to bool*.
* cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*.
(get_setshow_command_value_string): Likewise.
* cli/cli-style.c (cli_styling): Change to bool.
(source_styling): Likewise.
* cli/cli-style.h (source_styling): Likewise.
(cli_styling): Likewise.
* cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change
to bool.
* command.h (var_types): Update comment.
(add_setshow_boolean_cmd): Change int* var argument to bool*.
* compile/compile-cplus-types.c (debug_compile_cplus_types): Change to
bool.
(debug_compile_cplus_scopes): Likewise.
* compile/compile-internal.h (compile_debug): Likewise.
* compile/compile.c (compile_debug): Likewise.
(struct compile_options) <raw>: Likewise.
* cp-support.c (catch_demangler_crashes): Likewise.
* cris-tdep.c (usr_cmd_cris_version_valid): Likewise.
(usr_cmd_cris_dwarf2_cfi): Likewise.
* csky-tdep.c (csky_debug): Likewise.
* darwin-nat.c (enable_mach_exceptions): Likewise.
* dcache.c (dcache_enabled_p): Likewise.
* defs.h (info_verbose): Likewise.
* demangle.c (demangle): Likewise.
(asm_demangle): Likewise.
* dwarf-index-cache.c (debug_index_cache): Likewise.
* dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2read.c (check_physname): Likewise.
(use_deprecated_index_sections): Likewise.
(dwarf_always_disassemble): Likewise.
* eval.c (overload_resolution): Likewise.
* event-top.c (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* event-top.h (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* exec.c (write_files): Likewise.
* fbsd-nat.c (debug_fbsd_lwp): Likewise
(debug_fbsd_nat): Likewise.
* frame.h (struct frame_print_options) <print_raw_frame_arguments>:
Likewise.
(struct set_backtrace_options) <backtrace_past_main>: Likewise.
<backtrace_past_entry> Likewise.
* gdb-demangle.h (demangle): Likewise.
(asm_demangle): Likewise.
* gdb_bfd.c (bfd_sharing): Likewise.
* gdbcore.h (write_files): Likewise.
* gdbsupport/common-debug.c (show_debug_regs): Likewise.
* gdbsupport/common-debug.h (show_debug_regs): Likewise.
* gdbthread.h (print_thread_events): Likewise.
* gdbtypes.c (opaque_type_resolution): Likewise.
(strict_type_checking): Likewise.
* gnu-nat.c (gnu_debug_flag): Likewise.
* guile/scm-auto-load.c (auto_load_guile_scripts): Likewise.
* guile/scm-param.c (pascm_variable): Add boolval.
(add_setshow_generic): Update.
(pascm_param_value): Update.
(pascm_set_param_value_x): Update.
* hppa-tdep.c (hppa_debug): Change to bool..
* infcall.c (may_call_functions_p): Likewise.
(coerce_float_to_double_p): Likewise.
(unwind_on_signal_p): Likewise.
(unwind_on_terminating_exception_p): Likewise.
* infcmd.c (startup_with_shell): Likewise.
* inferior.c (print_inferior_events): Likewise.
* inferior.h (startup_with_shell): Likewise.
(print_inferior_events): Likewise.
* infrun.c (step_stop_if_no_debug): Likewise.
(detach_fork): Likewise.
(debug_displaced): Likewise.
(disable_randomization): Likewise.
(non_stop): Likewise.
(non_stop_1): Likewise.
(observer_mode): Likewise.
(observer_mode_1): Likewise.
(set_observer_mode): Update.
(sched_multi): Change to bool.
* infrun.h (debug_displaced): Likewise.
(sched_multi): Likewise.
(step_stop_if_no_debug): Likewise.
(non_stop): Likewise.
(disable_randomization): Likewise.
* linux-tdep.c (use_coredump_filter): Likewise.
(dump_excluded_mappings): Likewise.
* linux-thread-db.c (auto_load_thread_db): Likewise.
(check_thread_db_on_load): Likewise.
* main.c (captured_main_1): Update.
* maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt,
xx2_opt, boolean_opt>: Change to bool.
* maint-test-settings.c (maintenance_test_settings_boolean): Likewise.
* maint.c (maintenance_profile_p): Likewise.
(per_command_time): Likewise.
(per_command_space): Likewise.
(per_command_symtab): Likewise.
* memattr.c (inaccessible_by_default): Likewise.
* mi/mi-main.c (mi_async): Likewise.
(mi_async_1): Likewise.
* mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise.
* nat/fork-inferior.h (startup_with_shell): Likewise.
* nat/linux-namespaces.c (debug_linux_namespaces): Likewise.
* nat/linux-namespaces.h (debug_linux_namespaces): Likewise.
* nios2-tdep.c (nios2_debug): Likewise.
* or1k-tdep.c (or1k_debug): Likewise.
* parse.c (parser_debug): Likewise.
* parser-defs.h (parser_debug): Likewise.
* printcmd.c (print_symbol_filename): Likewise.
* proc-api.c (procfs_trace): Likewise.
* python/py-auto-load.c (auto_load_python_scripts): Likewise.
* python/py-param.c (union parmpy_variable): Add "bool boolval" field.
(set_parameter_value): Update.
(add_setshow_generic): Update.
* python/py-value.c (copy_py_bool_obj): Change argument from int*
to bool*.
* python/python.c (gdbpy_parameter_value): Cast to bool* instead of
int*.
* ravenscar-thread.c (ravenscar_task_support): Change to bool.
* record-btrace.c (record_btrace_target::store_registers): Update.
* record-full.c (record_full_memory_query): Change to bool.
(record_full_stop_at_limit): Likewise.
* record-full.h (record_full_memory_query): Likewise.
* remote-notif.c (notif_debug): Likewise.
* remote-notif.h (notif_debug): Likewise.
* remote.c (use_range_stepping): Likewise.
(interrupt_on_connect): Likewise.
(remote_break): Likewise.
* ser-tcp.c (tcp_auto_retry): Likewise.
* ser-unix.c (serial_hwflow): Likewise.
* skip.c (debug_skip): Likewise.
* solib-aix.c (solib_aix_debug): Likewise.
* spu-tdep.c (spu_stop_on_load_p): Likewise.
(spu_auto_flush_cache_p): Likewise.
* stack.c (struct backtrace_cmd_options) <full, no_filters, hide>:
Likewise.
(struct info_print_options) <quiet>: Likewise.
* symfile-debug.c (debug_symfile): Likewise.
* symfile.c (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symfile.h (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symtab.c (basenames_may_differ): Likewise.
(struct filename_partial_match_opts) <dirname, basename>: Likewise.
(struct info_print_options) <quiet, exclude_minsyms>: Likewise.
(struct info_types_options) <quiet>: Likewise.
* symtab.h (demangle): Likewise.
(basenames_may_differ): Likewise.
* target-dcache.c (stack_cache_enabled_1): Likewise.
(code_cache_enabled_1): Likewise.
* target.c (trust_readonly): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
(auto_connect_native_target): Likewise.
(target_stop_and_wait): Update.
(target_async_permitted): Change to bool.
(target_async_permitted_1): Likewise.
(may_write_registers_1): Likewise.
(may_write_memory_1): Likewise.
(may_insert_breakpoints_1): Likewise.
(may_insert_tracepoints_1): Likewise.
(may_insert_fast_tracepoints_1): Likewise.
(may_stop_1): Likewise.
* target.h (target_async_permitted): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
* thread.c (struct info_threads_opts) <show_global_ids>: Likewise.
(make_thread_apply_all_options_def_group): Change argument from int*
to bool*.
(thread_apply_all_command): Update.
(print_thread_events): Change to bool.
* top.c (confirm): Likewise.
(command_editing_p): Likewise.
(history_expansion_p): Likewise.
(write_history_p): Likewise.
(info_verbose): Likewise.
* top.h (confirm): Likewise.
(history_expansion_p): Likewise.
* tracepoint.c (disconnected_tracing): Likewise.
(circular_trace_buffer): Likewise.
* typeprint.c (print_methods): Likewise.
(print_typedefs): Likewise.
* utils.c (debug_timestamp): Likewise.
(sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* utils.h (sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* valops.c (overload_resolution): Likewise.
* valprint.h (struct value_print_options) <prettyformat_arrays,
prettyformat_structs, vtblprint, unionprint, addressprint, objectprint,
stop_print_at_null, print_array_indexes, deref_ref, static_field_print,
pascal_static_field_print, raw, summary, symbol_print, finish_print>:
Likewise.
* windows-nat.c (new_console): Likewise.
(cygwin_exceptions): Likewise.
(new_group): Likewise.
(debug_exec): Likewise.
(debug_events): Likewise.
(debug_memory): Likewise.
(debug_exceptions): Likewise.
(useshell): Likewise.
* windows-tdep.c (maint_display_all_tib): Likewise.
* xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
|
|
|
bool record_full_memory_query = false;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_core_buf_entry
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_core_buf_entry *prev;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
struct target_section *p;
|
|
|
|
bfd_byte *buf;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Record buf with core target. */
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
static detached_regcache *record_full_core_regbuf = NULL;
|
2013-03-11 09:44:14 +01:00
|
|
|
static struct target_section *record_full_core_start;
|
|
|
|
static struct target_section *record_full_core_end;
|
|
|
|
static struct record_full_core_buf_entry *record_full_core_buf_list = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* The following variables are used for managing the linked list that
|
|
|
|
represents the execution log.
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_first is the anchor that holds down the beginning of
|
|
|
|
the list.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list serves two functions:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
1) In record mode, it anchors the end of the list.
|
|
|
|
2) In replay mode, it traverses the list and points to
|
|
|
|
the next instruction that must be emulated.
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_head and record_full_arch_list_tail are used
|
|
|
|
to manage a separate list, which is used to build up the change
|
|
|
|
elements of the currently executing instruction during record mode.
|
|
|
|
When this instruction has been completely annotated in the "arch
|
|
|
|
list", it will be appended to the main execution log. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static struct record_full_entry record_full_first;
|
|
|
|
static struct record_full_entry *record_full_list = &record_full_first;
|
|
|
|
static struct record_full_entry *record_full_arch_list_head = NULL;
|
|
|
|
static struct record_full_entry *record_full_arch_list_tail = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Change boolean options to bool instead of int
This is for add_setshow_boolean_cmd as well as the gdb::option interface.
gdb/ChangeLog:
2019-09-17 Christian Biesinger <cbiesinger@google.com>
* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
(print_signatures): Likewise.
(trust_pad_over_xvs): Likewise.
* arch/aarch64-insn.c (aarch64_debug): Likewise.
* arch/aarch64-insn.h (aarch64_debug): Likewise.
* arm-linux-nat.c (arm_apcs_32): Likewise.
* arm-linux-tdep.c (arm_apcs_32): Likewise.
* arm-nbsd-nat.c (arm_apcs_32): Likewise.
* arm-tdep.c (arm_debug): Likewise.
(arm_apcs_32): Likewise.
* auto-load.c (debug_auto_load): Likewise.
(auto_load_gdb_scripts): Likewise.
(global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* auto-load.h (global_auto_load): Likewise.
(auto_load_local_gdbinit): Likewise.
(auto_load_local_gdbinit_loaded): Likewise.
* breakpoint.c (disconnected_dprintf): Likewise.
(breakpoint_proceeded): Likewise.
(automatic_hardware_breakpoints): Likewise.
(always_inserted_mode): Likewise.
(target_exact_watchpoints): Likewise.
(_initialize_breakpoint): Update.
* breakpoint.h (target_exact_watchpoints): Change to bool.
* btrace.c (maint_btrace_pt_skip_pad): Likewise.
* cli/cli-cmds.c (trace_commands): Likewise.
* cli/cli-cmds.h (trace_commands): Likewise.
* cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument
to bool*.
* cli/cli-logging.c (logging_overwrite): Change to bool.
(logging_redirect): Likewise.
(debug_redirect): Likewise.
* cli/cli-option.h (option_def) <boolean>: Change return type to bool*.
(struct boolean_option_def) <get_var_address_cb_>: Change return type
to bool.
<boolean_option_def>: Update.
(struct flag_option_def): Change default type of Context to bool
from int.
<flag_option_def>: Change return type of var_address_cb_ to bool*.
* cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*.
(get_setshow_command_value_string): Likewise.
* cli/cli-style.c (cli_styling): Change to bool.
(source_styling): Likewise.
* cli/cli-style.h (source_styling): Likewise.
(cli_styling): Likewise.
* cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change
to bool.
* command.h (var_types): Update comment.
(add_setshow_boolean_cmd): Change int* var argument to bool*.
* compile/compile-cplus-types.c (debug_compile_cplus_types): Change to
bool.
(debug_compile_cplus_scopes): Likewise.
* compile/compile-internal.h (compile_debug): Likewise.
* compile/compile.c (compile_debug): Likewise.
(struct compile_options) <raw>: Likewise.
* cp-support.c (catch_demangler_crashes): Likewise.
* cris-tdep.c (usr_cmd_cris_version_valid): Likewise.
(usr_cmd_cris_dwarf2_cfi): Likewise.
* csky-tdep.c (csky_debug): Likewise.
* darwin-nat.c (enable_mach_exceptions): Likewise.
* dcache.c (dcache_enabled_p): Likewise.
* defs.h (info_verbose): Likewise.
* demangle.c (demangle): Likewise.
(asm_demangle): Likewise.
* dwarf-index-cache.c (debug_index_cache): Likewise.
* dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise.
* dwarf2read.c (check_physname): Likewise.
(use_deprecated_index_sections): Likewise.
(dwarf_always_disassemble): Likewise.
* eval.c (overload_resolution): Likewise.
* event-top.c (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* event-top.h (set_editing_cmd_var): Likewise.
(exec_done_display_p): Likewise.
* exec.c (write_files): Likewise.
* fbsd-nat.c (debug_fbsd_lwp): Likewise
(debug_fbsd_nat): Likewise.
* frame.h (struct frame_print_options) <print_raw_frame_arguments>:
Likewise.
(struct set_backtrace_options) <backtrace_past_main>: Likewise.
<backtrace_past_entry> Likewise.
* gdb-demangle.h (demangle): Likewise.
(asm_demangle): Likewise.
* gdb_bfd.c (bfd_sharing): Likewise.
* gdbcore.h (write_files): Likewise.
* gdbsupport/common-debug.c (show_debug_regs): Likewise.
* gdbsupport/common-debug.h (show_debug_regs): Likewise.
* gdbthread.h (print_thread_events): Likewise.
* gdbtypes.c (opaque_type_resolution): Likewise.
(strict_type_checking): Likewise.
* gnu-nat.c (gnu_debug_flag): Likewise.
* guile/scm-auto-load.c (auto_load_guile_scripts): Likewise.
* guile/scm-param.c (pascm_variable): Add boolval.
(add_setshow_generic): Update.
(pascm_param_value): Update.
(pascm_set_param_value_x): Update.
* hppa-tdep.c (hppa_debug): Change to bool..
* infcall.c (may_call_functions_p): Likewise.
(coerce_float_to_double_p): Likewise.
(unwind_on_signal_p): Likewise.
(unwind_on_terminating_exception_p): Likewise.
* infcmd.c (startup_with_shell): Likewise.
* inferior.c (print_inferior_events): Likewise.
* inferior.h (startup_with_shell): Likewise.
(print_inferior_events): Likewise.
* infrun.c (step_stop_if_no_debug): Likewise.
(detach_fork): Likewise.
(debug_displaced): Likewise.
(disable_randomization): Likewise.
(non_stop): Likewise.
(non_stop_1): Likewise.
(observer_mode): Likewise.
(observer_mode_1): Likewise.
(set_observer_mode): Update.
(sched_multi): Change to bool.
* infrun.h (debug_displaced): Likewise.
(sched_multi): Likewise.
(step_stop_if_no_debug): Likewise.
(non_stop): Likewise.
(disable_randomization): Likewise.
* linux-tdep.c (use_coredump_filter): Likewise.
(dump_excluded_mappings): Likewise.
* linux-thread-db.c (auto_load_thread_db): Likewise.
(check_thread_db_on_load): Likewise.
* main.c (captured_main_1): Update.
* maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt,
xx2_opt, boolean_opt>: Change to bool.
* maint-test-settings.c (maintenance_test_settings_boolean): Likewise.
* maint.c (maintenance_profile_p): Likewise.
(per_command_time): Likewise.
(per_command_space): Likewise.
(per_command_symtab): Likewise.
* memattr.c (inaccessible_by_default): Likewise.
* mi/mi-main.c (mi_async): Likewise.
(mi_async_1): Likewise.
* mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise.
* nat/fork-inferior.h (startup_with_shell): Likewise.
* nat/linux-namespaces.c (debug_linux_namespaces): Likewise.
* nat/linux-namespaces.h (debug_linux_namespaces): Likewise.
* nios2-tdep.c (nios2_debug): Likewise.
* or1k-tdep.c (or1k_debug): Likewise.
* parse.c (parser_debug): Likewise.
* parser-defs.h (parser_debug): Likewise.
* printcmd.c (print_symbol_filename): Likewise.
* proc-api.c (procfs_trace): Likewise.
* python/py-auto-load.c (auto_load_python_scripts): Likewise.
* python/py-param.c (union parmpy_variable): Add "bool boolval" field.
(set_parameter_value): Update.
(add_setshow_generic): Update.
* python/py-value.c (copy_py_bool_obj): Change argument from int*
to bool*.
* python/python.c (gdbpy_parameter_value): Cast to bool* instead of
int*.
* ravenscar-thread.c (ravenscar_task_support): Change to bool.
* record-btrace.c (record_btrace_target::store_registers): Update.
* record-full.c (record_full_memory_query): Change to bool.
(record_full_stop_at_limit): Likewise.
* record-full.h (record_full_memory_query): Likewise.
* remote-notif.c (notif_debug): Likewise.
* remote-notif.h (notif_debug): Likewise.
* remote.c (use_range_stepping): Likewise.
(interrupt_on_connect): Likewise.
(remote_break): Likewise.
* ser-tcp.c (tcp_auto_retry): Likewise.
* ser-unix.c (serial_hwflow): Likewise.
* skip.c (debug_skip): Likewise.
* solib-aix.c (solib_aix_debug): Likewise.
* spu-tdep.c (spu_stop_on_load_p): Likewise.
(spu_auto_flush_cache_p): Likewise.
* stack.c (struct backtrace_cmd_options) <full, no_filters, hide>:
Likewise.
(struct info_print_options) <quiet>: Likewise.
* symfile-debug.c (debug_symfile): Likewise.
* symfile.c (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symfile.h (auto_solib_add): Likewise.
(separate_debug_file_debug): Likewise.
* symtab.c (basenames_may_differ): Likewise.
(struct filename_partial_match_opts) <dirname, basename>: Likewise.
(struct info_print_options) <quiet, exclude_minsyms>: Likewise.
(struct info_types_options) <quiet>: Likewise.
* symtab.h (demangle): Likewise.
(basenames_may_differ): Likewise.
* target-dcache.c (stack_cache_enabled_1): Likewise.
(code_cache_enabled_1): Likewise.
* target.c (trust_readonly): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
(auto_connect_native_target): Likewise.
(target_stop_and_wait): Update.
(target_async_permitted): Change to bool.
(target_async_permitted_1): Likewise.
(may_write_registers_1): Likewise.
(may_write_memory_1): Likewise.
(may_insert_breakpoints_1): Likewise.
(may_insert_tracepoints_1): Likewise.
(may_insert_fast_tracepoints_1): Likewise.
(may_stop_1): Likewise.
* target.h (target_async_permitted): Likewise.
(may_write_registers): Likewise.
(may_write_memory): Likewise.
(may_insert_breakpoints): Likewise.
(may_insert_tracepoints): Likewise.
(may_insert_fast_tracepoints): Likewise.
(may_stop): Likewise.
* thread.c (struct info_threads_opts) <show_global_ids>: Likewise.
(make_thread_apply_all_options_def_group): Change argument from int*
to bool*.
(thread_apply_all_command): Update.
(print_thread_events): Change to bool.
* top.c (confirm): Likewise.
(command_editing_p): Likewise.
(history_expansion_p): Likewise.
(write_history_p): Likewise.
(info_verbose): Likewise.
* top.h (confirm): Likewise.
(history_expansion_p): Likewise.
* tracepoint.c (disconnected_tracing): Likewise.
(circular_trace_buffer): Likewise.
* typeprint.c (print_methods): Likewise.
(print_typedefs): Likewise.
* utils.c (debug_timestamp): Likewise.
(sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* utils.h (sevenbit_strings): Likewise.
(pagination_enabled): Likewise.
* valops.c (overload_resolution): Likewise.
* valprint.h (struct value_print_options) <prettyformat_arrays,
prettyformat_structs, vtblprint, unionprint, addressprint, objectprint,
stop_print_at_null, print_array_indexes, deref_ref, static_field_print,
pascal_static_field_print, raw, summary, symbol_print, finish_print>:
Likewise.
* windows-nat.c (new_console): Likewise.
(cygwin_exceptions): Likewise.
(new_group): Likewise.
(debug_exec): Likewise.
(debug_events): Likewise.
(debug_memory): Likewise.
(debug_exceptions): Likewise.
(useshell): Likewise.
* windows-tdep.c (maint_display_all_tib): Likewise.
* xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
|
|
|
/* true ask user. false auto delete the last struct record_full_entry. */
|
|
|
|
static bool record_full_stop_at_limit = true;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Maximum allowed number of insns in execution log. */
|
2013-03-11 09:44:14 +01:00
|
|
|
static unsigned int record_full_insn_max_num
|
|
|
|
= DEFAULT_RECORD_FULL_INSN_MAX_NUM;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Actual count of insns presently in execution log. */
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
static unsigned int record_full_insn_num = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Count of insns logged so far (may be larger
|
|
|
|
than count of insns presently in execution log). */
|
2013-03-11 09:44:14 +01:00
|
|
|
static ULONGEST record_full_insn_count;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
static const char record_longname[]
|
|
|
|
= N_("Process record and replay target");
|
|
|
|
static const char record_doc[]
|
|
|
|
= N_("Log program while executing and replay execution from log.");
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* Base class implementing functionality common to both the
|
|
|
|
"record-full" and "record-core" targets. */
|
|
|
|
|
|
|
|
class record_full_base_target : public target_ops
|
|
|
|
{
|
|
|
|
public:
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
const target_info &info () const override = 0;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
target_ops::to_stratum -> target_ops::stratum() virtual method
Given that a target's stratum is a property of the type, and not of an
instance of the type, get rid of to_stratum data field and replace it
with a virtual method.
I.e., when we have e.g., 10 target remote instances active, there's no
need for each of the instances to have their own to_stratum copy.
gdb/ChangeLog:
2018-11-30 Pedro Alves <palves@redhat.com>
* aix-thread.c (aix_thread_target) <aix_thread_target>: Delete.
<stratum>: New override.
* bfd-target.c (aix_thread_target) <aix_thread_target>: Delete.
<stratum>: New override.
* bsd-uthread.c (bsd_uthread_target) <bsd_uthread_target>: Delete.
<stratum>: New override.
* exec.c (exec_target) <exec_target>: Delete.
<stratum>: New override.
* gdbarch-selftests.c (register_to_value_test): Adjust to use the
stratum method instead of the to_stratum field.
* linux-thread-db.c (thread_db_target) <thread_db_target>: Delete.
<stratum>: New override.
(thread_db_target::thread_db_target): Delete.
* make-target-delegates (print_class): Don't print a ctor
declaration. Print a stratum method override declaration.
* process-stratum-target.h (process_stratum_target)
<process_stratum_target>: Delete.
<stratum>: New override.
* ravenscar-thread.c (ravenscar_thread_target)
<ravenscar_thread_target>: Delete.
<stratum>: New override.
* record-btrace.c (record_btrace_target)
<record_btrace_target>: Delete.
<stratum>: New override.
* record-full.c (record_full_base_target)
<record_full_base_target>: Delete.
<stratum>: New override.
* record.c (record_disconnect, record_detach)
(record_mourn_inferior, record_kill): Adjust to use the stratum
method instead of the to_stratum field.
* regcache.c (cooked_read_test, cooked_write_test): Likewise.
* sol-thread.c (sol_thread_target)
<sol_thread_target>: Delete.
<stratum>: New override.
* spu-multiarch.c (spu_multiarch_target)
<spu_multiarch_target>: Delete.
<stratum>: New override.
* target-delegates.c: Regenerate.
* target.c (target_stack::push, target_stack::unpush)
(pop_all_targets_above, pop_all_targets_at_and_above)
(info_target_command, target_require_runnable)
(target_stack::find_beneath): Adjust to use the stratum method
instead of the to_stratum field.
(dummy_target::dummy_target): Delete.
(dummy_target::stratum): New.
(debug_target::debug_target): Delete.
(debug_target::stratum): New.
(maintenance_print_target_stack): Adjust to use the stratum method
instead of the to_stratum field.
* target.h (struct target_ops) <stratum>: New method.
<to_stratum>: Delete.
<is_pushed>: Adjust to use the stratum method
instead of the to_stratum field.
2018-11-30 18:49:49 +01:00
|
|
|
strata stratum () const override { return record_stratum; }
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void close () override;
|
|
|
|
void async (int) override;
|
|
|
|
ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool stopped_by_watchpoint () override;
|
|
|
|
bool stopped_data_address (CORE_ADDR *) override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool stopped_by_sw_breakpoint () override;
|
|
|
|
bool supports_stopped_by_sw_breakpoint () override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool stopped_by_hw_breakpoint () override;
|
|
|
|
bool supports_stopped_by_hw_breakpoint () override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool can_execute_reverse () override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
|
|
|
/* Add bookmark target methods. */
|
|
|
|
gdb_byte *get_bookmark (const char *, int) override;
|
|
|
|
void goto_bookmark (const gdb_byte *, int) override;
|
|
|
|
enum exec_direction_kind execution_direction () override;
|
|
|
|
enum record_method record_method (ptid_t ptid) override;
|
|
|
|
void info_record () override;
|
|
|
|
void save_record (const char *filename) override;
|
|
|
|
bool supports_delete_record () override;
|
|
|
|
void delete_record () override;
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool record_is_replaying (ptid_t ptid) override;
|
|
|
|
bool record_will_replay (ptid_t ptid, int dir) override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void record_stop_replaying () override;
|
|
|
|
void goto_record_begin () override;
|
|
|
|
void goto_record_end () override;
|
|
|
|
void goto_record (ULONGEST insn) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The "record-full" target. */
|
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
static const target_info record_full_target_info = {
|
|
|
|
"record-full",
|
|
|
|
record_longname,
|
|
|
|
record_doc,
|
|
|
|
};
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
class record_full_target final : public record_full_base_target
|
|
|
|
{
|
|
|
|
public:
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
const target_info &info () const override
|
|
|
|
{ return record_full_target_info; }
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
|
|
|
void commit_resume () override;
|
|
|
|
void resume (ptid_t, int, enum gdb_signal) override;
|
|
|
|
void disconnect (const char *, int) override;
|
|
|
|
void detach (inferior *, int) override;
|
|
|
|
void mourn_inferior () override;
|
|
|
|
void kill () override;
|
|
|
|
void store_registers (struct regcache *, int) override;
|
|
|
|
enum target_xfer_status xfer_partial (enum target_object object,
|
|
|
|
const char *annex,
|
|
|
|
gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf,
|
|
|
|
ULONGEST offset, ULONGEST len,
|
|
|
|
ULONGEST *xfered_len) override;
|
|
|
|
int insert_breakpoint (struct gdbarch *,
|
|
|
|
struct bp_target_info *) override;
|
|
|
|
int remove_breakpoint (struct gdbarch *,
|
|
|
|
struct bp_target_info *,
|
|
|
|
enum remove_bp_reason) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The "record-core" target. */
|
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
static const target_info record_full_core_target_info = {
|
|
|
|
"record-core",
|
|
|
|
record_longname,
|
|
|
|
record_doc,
|
|
|
|
};
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
class record_full_core_target final : public record_full_base_target
|
|
|
|
{
|
|
|
|
public:
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
const target_info &info () const override
|
|
|
|
{ return record_full_core_target_info; }
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
|
|
|
void resume (ptid_t, int, enum gdb_signal) override;
|
|
|
|
void disconnect (const char *, int) override;
|
|
|
|
void kill () override;
|
|
|
|
void fetch_registers (struct regcache *regcache, int regno) override;
|
|
|
|
void prepare_to_store (struct regcache *regcache) override;
|
|
|
|
void store_registers (struct regcache *, int) override;
|
|
|
|
enum target_xfer_status xfer_partial (enum target_object object,
|
|
|
|
const char *annex,
|
|
|
|
gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf,
|
|
|
|
ULONGEST offset, ULONGEST len,
|
|
|
|
ULONGEST *xfered_len) override;
|
|
|
|
int insert_breakpoint (struct gdbarch *,
|
|
|
|
struct bp_target_info *) override;
|
|
|
|
int remove_breakpoint (struct gdbarch *,
|
|
|
|
struct bp_target_info *,
|
|
|
|
enum remove_bp_reason) override;
|
|
|
|
|
Make target_ops::has_execution take an 'inferior *' instead of a ptid_t
With the multi-target work, each inferior will have its own target
stack, so to call a target method, we'll need to make sure that the
inferior in question is the current one, otherwise target->beneath()
calls will find the target beneath in the wrong inferior.
In some places, it's much more convenient to be able to check whether
an inferior has execution without having to switch to it in order to
call target_has_execution on the right inferior/target stack, to avoid
side effects with switching inferior/thread/program space.
The current target_ops::has_execution method takes a ptid_t as
parameter, which, in a multi-target world, isn't sufficient to
identify the target. This patch prepares to address that, by changing
the parameter to an inferior pointer instead. From the inferior,
we'll be able to query its target stack to tell which target is
beneath.
Also adds a new inferior::has_execution() method to make callers a bit
more natural to read.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* corelow.c (core_target::has_execution): Change parameter type to
inferior pointer.
* inferior.c (number_of_live_inferiors): Use
inferior::has_execution instead of target_has_execution_1.
* inferior.h (inferior::has_execution): New.
* linux-thread-db.c (thread_db_target::update_thread_list): Use
inferior::has_execution instead of target_has_execution_1.
* process-stratum-target.c
(process_stratum_target::has_execution): Change parameter type to
inferior pointer. Check the inferior's PID instead of
inferior_ptid.
* process-stratum-target.h
(process_stratum_target::has_execution): Change parameter type to
inferior pointer.
* record-full.c (record_full_core_target::has_execution): Change
parameter type to inferior pointer.
* target.c (target_has_execution_1): Change parameter type to
inferior pointer.
(target_has_execution_current): Adjust.
* target.h (target_ops::has_execution): Change parameter type to
inferior pointer.
(target_has_execution_1): Change parameter type to inferior
pointer. Change return type to bool.
* tracefile.h (tracefile_target::has_execution): Change parameter
type to inferior pointer.
2020-01-10 21:05:44 +01:00
|
|
|
bool has_execution (inferior *inf) override;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static record_full_target record_full_ops;
|
|
|
|
static record_full_core_target record_full_core_ops;
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_target::detach (inferior *inf, int from_tty)
|
|
|
|
{
|
|
|
|
record_detach (this, inf, from_tty);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_target::disconnect (const char *args, int from_tty)
|
|
|
|
{
|
|
|
|
record_disconnect (this, args, from_tty);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_core_target::disconnect (const char *args, int from_tty)
|
|
|
|
{
|
|
|
|
record_disconnect (this, args, from_tty);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_target::mourn_inferior ()
|
|
|
|
{
|
|
|
|
record_mourn_inferior (this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_target::kill ()
|
|
|
|
{
|
|
|
|
record_kill (this);
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Fix "is a record target open" checks.
RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use. This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.
To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack. Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.
That exercise then reveals other issues:
- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED. But, record_full_ calls shouldn't be made when
recording with the record-btrace target. So this adds a new
record_full_is_used predicate to be used in that spot.
- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target). record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does. The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.
Tested on x86_64 Fedora 17.
gdb/
2014-01-14 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* infrun.c (use_displaced_stepping): Use find_record_target
instead of RECORD_IS_USED.
(adjust_pc_after_break): Use record_full_is_used instead of
RECORD_IS_USED.
* record-btrace.c (record_btrace_open): Call record_preopen
instead of checking RECORD_IS_USED.
* record-full.c (record_full_shortname)
(record_full_core_shortname): New globals.
(record_full_is_used): New function.
(find_full_open): Call record_preopen instead of checking
RECORD_IS_USED.
(init_record_full_ops): Set the target's shortname to
record_full_shortname.
(init_record_full_core_ops): Set the target's shortname to
record_full_core_shortname.
* record-full.h (record_full_is_used): Declare.
* record.c (find_record_target): Make extern.
(record_preopen): New function.
* record.h (RECORD_IS_USED): Delete macro.
(find_record_target, record_preopen): Declare functions.
2014-01-14 17:12:19 +01:00
|
|
|
/* See record-full.h. */
|
|
|
|
|
|
|
|
int
|
|
|
|
record_full_is_used (void)
|
|
|
|
{
|
|
|
|
struct target_ops *t;
|
|
|
|
|
|
|
|
t = find_record_target ();
|
|
|
|
return (t == &record_full_ops
|
|
|
|
|| t == &record_full_core_ops);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Command lists for "set/show record full". */
|
|
|
|
static struct cmd_list_element *set_record_full_cmdlist;
|
|
|
|
static struct cmd_list_element *show_record_full_cmdlist;
|
|
|
|
|
|
|
|
/* Command list for "record full". */
|
|
|
|
static struct cmd_list_element *record_full_cmdlist;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static void record_full_goto_insn (struct record_full_entry *entry,
|
|
|
|
enum exec_direction_kind dir);
|
|
|
|
|
|
|
|
/* Alloc and free functions for record_full_reg, record_full_mem, and
|
|
|
|
record_full_end entries. */
|
|
|
|
|
|
|
|
/* Alloc a record_full_reg record entry. */
|
|
|
|
|
|
|
|
static inline struct record_full_entry *
|
|
|
|
record_full_reg_alloc (struct regcache *regcache, int regnum)
|
|
|
|
{
|
|
|
|
struct record_full_entry *rec;
|
2017-10-25 17:37:03 +02:00
|
|
|
struct gdbarch *gdbarch = regcache->arch ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
|
|
|
rec = XCNEW (struct record_full_entry);
|
2013-03-11 09:44:14 +01:00
|
|
|
rec->type = record_full_reg;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
rec->u.reg.num = regnum;
|
|
|
|
rec->u.reg.len = register_size (gdbarch, regnum);
|
|
|
|
if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
|
|
|
|
rec->u.reg.u.ptr = (gdb_byte *) xmalloc (rec->u.reg.len);
|
|
|
|
|
|
|
|
return rec;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Free a record_full_reg record entry. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static inline void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_reg_release (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
gdb_assert (rec->type == record_full_reg);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
|
|
|
|
xfree (rec->u.reg.u.ptr);
|
|
|
|
xfree (rec);
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Alloc a record_full_mem record entry. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static inline struct record_full_entry *
|
|
|
|
record_full_mem_alloc (CORE_ADDR addr, int len)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
|
|
|
rec = XCNEW (struct record_full_entry);
|
2013-03-11 09:44:14 +01:00
|
|
|
rec->type = record_full_mem;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
rec->u.mem.addr = addr;
|
|
|
|
rec->u.mem.len = len;
|
|
|
|
if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
|
|
|
|
rec->u.mem.u.ptr = (gdb_byte *) xmalloc (len);
|
|
|
|
|
|
|
|
return rec;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Free a record_full_mem record entry. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static inline void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_mem_release (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
gdb_assert (rec->type == record_full_mem);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
|
|
|
|
xfree (rec->u.mem.u.ptr);
|
|
|
|
xfree (rec);
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Alloc a record_full_end record entry. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static inline struct record_full_entry *
|
|
|
|
record_full_end_alloc (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
|
|
|
rec = XCNEW (struct record_full_entry);
|
2013-03-11 09:44:14 +01:00
|
|
|
rec->type = record_full_end;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
return rec;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Free a record_full_end record entry. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static inline void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_end_release (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
xfree (rec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free one record entry, any type.
|
|
|
|
Return entry->type, in case caller wants to know. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static inline enum record_full_type
|
|
|
|
record_full_entry_release (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
enum record_full_type type = rec->type;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
switch (type) {
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_reg:
|
|
|
|
record_full_reg_release (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_mem:
|
|
|
|
record_full_mem_release (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_end:
|
|
|
|
record_full_end_release (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free all record entries in list pointed to by REC. */
|
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (!rec)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (rec->next)
|
|
|
|
rec = rec->next;
|
|
|
|
|
|
|
|
while (rec->prev)
|
|
|
|
{
|
|
|
|
rec = rec->prev;
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_entry_release (rec->next);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (rec == &record_full_first)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num = 0;
|
|
|
|
record_full_first.next = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_entry_release (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free all record entries forward of the given list position. */
|
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_following (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *tmp = rec->next;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
rec->next = NULL;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
rec = tmp->next;
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_entry_release (tmp) == record_full_end)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num--;
|
|
|
|
record_full_insn_count--;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
tmp = rec;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the first instruction from the beginning of the log, to make
|
|
|
|
room for adding a new instruction at the end of the log.
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
Note -- this function does not modify record_full_insn_num. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_first (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *tmp;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!record_full_first.next)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Loop until a record_full_end. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
while (1)
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Cut record_full_first.next out of the linked list. */
|
|
|
|
tmp = record_full_first.next;
|
|
|
|
record_full_first.next = tmp->next;
|
|
|
|
tmp->next->prev = &record_full_first;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* tmp is now isolated, and can be deleted. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_entry_release (tmp) == record_full_end)
|
|
|
|
break; /* End loop at first record_full_end. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!record_full_first.next)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
gdb_assert (record_full_insn_num == 1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break; /* End loop when list is empty. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Add a struct record_full_entry to record_full_arch_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_add (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_arch_list_add %s.\n",
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
host_address_to_string (rec));
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_arch_list_tail)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_tail->next = rec;
|
|
|
|
rec->prev = record_full_arch_list_tail;
|
|
|
|
record_full_arch_list_tail = rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_head = rec;
|
|
|
|
record_full_arch_list_tail = rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the value storage location of a record entry. */
|
|
|
|
static inline gdb_byte *
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_loc (struct record_full_entry *rec)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
switch (rec->type) {
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_mem:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
|
|
|
|
return rec->u.mem.u.ptr;
|
|
|
|
else
|
|
|
|
return rec->u.mem.u.buf;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_reg:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
|
|
|
|
return rec->u.reg.u.ptr;
|
|
|
|
else
|
|
|
|
return rec->u.reg.u.buf;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_end:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
default:
|
2013-03-11 09:44:14 +01:00
|
|
|
gdb_assert_not_reached ("unexpected record_full_entry type");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Record the value of a register NUM to record_full_arch_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
int
|
2013-03-11 09:45:54 +01:00
|
|
|
record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: add register num = %d to "
|
|
|
|
"record list.\n",
|
|
|
|
regnum);
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
rec = record_full_reg_alloc (regcache, regnum);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-05-30 20:54:36 +02:00
|
|
|
regcache->raw_read (regnum, record_full_get_loc (rec));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_add (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Record the value of a region of memory whose address is ADDR and
|
2013-03-11 09:44:14 +01:00
|
|
|
length is LEN to record_full_arch_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
int
|
2013-03-11 09:45:54 +01:00
|
|
|
record_full_arch_list_add_mem (CORE_ADDR addr, int len)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: add mem addr = %s len = %d to "
|
|
|
|
"record list.\n",
|
|
|
|
paddress (target_gdbarch (), addr), len);
|
|
|
|
|
|
|
|
if (!addr) /* FIXME: Why? Some arch must permit it... */
|
|
|
|
return 0;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
rec = record_full_mem_alloc (addr, len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_read_memory (target_gdbarch (), addr,
|
|
|
|
record_full_get_loc (rec), len))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_mem_release (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_add (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Add a record_full_end type struct record_full_entry to
|
|
|
|
record_full_arch_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
int
|
2013-03-11 09:45:54 +01:00
|
|
|
record_full_arch_list_add_end (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: add end to arch list.\n");
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
rec = record_full_end_alloc ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
rec->u.end.sigval = GDB_SIGNAL_0;
|
2013-03-11 09:44:14 +01:00
|
|
|
rec->u.end.insn_num = ++record_full_insn_count;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_add (rec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-04-12 17:49:32 +02:00
|
|
|
record_full_check_insn_num (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
if (record_full_insn_num == record_full_insn_max_num)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
/* Ask user what to do. */
|
|
|
|
if (record_full_stop_at_limit)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2016-04-12 17:49:32 +02:00
|
|
|
if (!yquery (_("Do you want to auto delete previous execution "
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
"log entries when record/replay buffer becomes "
|
2016-04-12 17:49:32 +02:00
|
|
|
"full (record full stop-at-limit)?")))
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
error (_("Process record: stopped by user."));
|
2016-04-12 17:49:32 +02:00
|
|
|
record_full_stop_at_limit = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Before inferior step (when GDB record the running message, inferior
|
|
|
|
only can step), GDB will call this function to record the values to
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list. This function will call gdbarch_process_record to
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
record the running message of inferior and set them to
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list, and add it to record_full_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.
https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures. However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code. This is what this commit does.
Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.
I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.
(Another approach could be to make catch_errors a variadic template
like:
template<typename Function, typename... Args>
int catch_errors (const char *errstring, return_mask mask,
Function &&func, Args... args);
and then with:
extern void function_with_args (int, int);
extern void function_with_no_args ();
calls to the above functions would be wrapped like this:
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_args, arg1, arg2);
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_no_args);
but I'm thinking that that doesn't improve much if at all either.)
gdb/ChangeLog
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros. Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors. Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter. Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.
gdb/testsuite/ChangeLog:
2017-10-10 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.
2017-10-10 17:45:50 +02:00
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_message (struct regcache *regcache, enum gdb_signal signal)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
int ret;
|
2017-10-25 17:37:03 +02:00
|
|
|
struct gdbarch *gdbarch = regcache->arch ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2019-04-04 00:02:42 +02:00
|
|
|
try
|
2018-06-07 23:56:37 +02:00
|
|
|
{
|
|
|
|
record_full_arch_list_head = NULL;
|
|
|
|
record_full_arch_list_tail = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Check record_full_insn_num. */
|
|
|
|
record_full_check_insn_num ();
|
|
|
|
|
|
|
|
/* If gdb sends a signal value to target_resume,
|
|
|
|
save it in the 'end' field of the previous instruction.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
Maybe process record should record what really happened,
|
|
|
|
rather than what gdb pretends has happened.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
So if Linux delivered the signal to the child process during
|
|
|
|
the record mode, we will record it and deliver it again in
|
|
|
|
the replay mode.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
If user says "ignore this signal" during the record mode, then
|
|
|
|
it will be ignored again during the replay mode (no matter if
|
|
|
|
the user says something different, like "deliver this signal"
|
|
|
|
during the replay mode).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
User should understand that nothing he does during the replay
|
|
|
|
mode will change the behavior of the child. If he tries,
|
|
|
|
then that is a user error.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
But we should still deliver the signal to gdb during the replay,
|
|
|
|
if we delivered it during the recording. Therefore we should
|
|
|
|
record the signal during record_full_wait, not
|
|
|
|
record_full_resume. */
|
|
|
|
if (record_full_list != &record_full_first) /* FIXME better way
|
|
|
|
to check */
|
|
|
|
{
|
|
|
|
gdb_assert (record_full_list->type == record_full_end);
|
|
|
|
record_full_list->u.end.sigval = signal;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
if (signal == GDB_SIGNAL_0
|
|
|
|
|| !gdbarch_process_record_signal_p (gdbarch))
|
|
|
|
ret = gdbarch_process_record (gdbarch,
|
|
|
|
regcache,
|
|
|
|
regcache_read_pc (regcache));
|
|
|
|
else
|
|
|
|
ret = gdbarch_process_record_signal (gdbarch,
|
|
|
|
regcache,
|
|
|
|
signal);
|
|
|
|
|
|
|
|
if (ret > 0)
|
|
|
|
error (_("Process record: inferior program stopped."));
|
|
|
|
if (ret < 0)
|
|
|
|
error (_("Process record: failed to record execution log."));
|
|
|
|
}
|
2019-04-03 23:59:07 +02:00
|
|
|
catch (const gdb_exception &ex)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Replace throw_exception with throw in some cases
This replaces throw_exception with "throw;" when possible. This was
written by script. The rule that is followed is that uses of the
form:
catch (... &name)
{
...
throw_exception (name);
}
... can be rewritten. This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.
2019-01-28 18:45:45 +01:00
|
|
|
throw;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->next = record_full_arch_list_head;
|
|
|
|
record_full_arch_list_head->prev = record_full_list;
|
|
|
|
record_full_list = record_full_arch_list_tail;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
if (record_full_insn_num == record_full_insn_max_num)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_first ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num++;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.
https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures. However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code. This is what this commit does.
Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.
I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.
(Another approach could be to make catch_errors a variadic template
like:
template<typename Function, typename... Args>
int catch_errors (const char *errstring, return_mask mask,
Function &&func, Args... args);
and then with:
extern void function_with_args (int, int);
extern void function_with_no_args ();
calls to the above functions would be wrapped like this:
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_args, arg1, arg2);
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_no_args);
but I'm thinking that that doesn't improve much if at all either.)
gdb/ChangeLog
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros. Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors. Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter. Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.
gdb/testsuite/ChangeLog:
2017-10-10 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.
2017-10-10 17:45:50 +02:00
|
|
|
static bool
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_message_wrapper_safe (struct regcache *regcache,
|
|
|
|
enum gdb_signal signal)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2019-04-04 00:02:42 +02:00
|
|
|
try
|
Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.
https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures. However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code. This is what this commit does.
Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.
I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.
(Another approach could be to make catch_errors a variadic template
like:
template<typename Function, typename... Args>
int catch_errors (const char *errstring, return_mask mask,
Function &&func, Args... args);
and then with:
extern void function_with_args (int, int);
extern void function_with_no_args ();
calls to the above functions would be wrapped like this:
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_args, arg1, arg2);
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_no_args);
but I'm thinking that that doesn't improve much if at all either.)
gdb/ChangeLog
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros. Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors. Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter. Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.
gdb/testsuite/ChangeLog:
2017-10-10 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.
2017-10-10 17:45:50 +02:00
|
|
|
{
|
|
|
|
record_full_message (regcache, signal);
|
|
|
|
}
|
2019-04-03 23:59:07 +02:00
|
|
|
catch (const gdb_exception &ex)
|
Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.
https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures. However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code. This is what this commit does.
Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.
I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.
(Another approach could be to make catch_errors a variadic template
like:
template<typename Function, typename... Args>
int catch_errors (const char *errstring, return_mask mask,
Function &&func, Args... args);
and then with:
extern void function_with_args (int, int);
extern void function_with_no_args ();
calls to the above functions would be wrapped like this:
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_args, arg1, arg2);
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_no_args);
but I'm thinking that that doesn't improve much if at all either.)
gdb/ChangeLog
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros. Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors. Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter. Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.
gdb/testsuite/ChangeLog:
2017-10-10 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.
2017-10-10 17:45:50 +02:00
|
|
|
{
|
|
|
|
exception_print (gdb_stderr, ex);
|
|
|
|
return false;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Eliminate catch_errors
If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.
https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures. However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code. This is what this commit does.
Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.
I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.
(Another approach could be to make catch_errors a variadic template
like:
template<typename Function, typename... Args>
int catch_errors (const char *errstring, return_mask mask,
Function &&func, Args... args);
and then with:
extern void function_with_args (int, int);
extern void function_with_no_args ();
calls to the above functions would be wrapped like this:
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_args, arg1, arg2);
catch_errors ("some error happened", RETURN_MASK_ERROR,
function_with_no_args);
but I'm thinking that that doesn't improve much if at all either.)
gdb/ChangeLog
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros. Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors. Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter. Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.
gdb/testsuite/ChangeLog:
2017-10-10 Pedro Alves <palves@redhat.com>
* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.
2017-10-10 17:45:50 +02:00
|
|
|
return true;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Set to 1 if record_full_store_registers and record_full_xfer_partial
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
doesn't need record. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static int record_full_gdb_operation_disable = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore_tmpl<int>
|
2013-03-11 09:45:54 +01:00
|
|
|
record_full_gdb_operation_disable_set (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-09-30 05:49:04 +02:00
|
|
|
return make_scoped_restore (&record_full_gdb_operation_disable, 1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Flag set to TRUE for target_stopped_by_watchpoint. */
|
2015-03-04 21:41:15 +01:00
|
|
|
static enum target_stop_reason record_full_stop_reason
|
|
|
|
= TARGET_STOPPED_BY_NO_REASON;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Execute one instruction from the record log. Each instruction in
|
|
|
|
the log will be represented by an arbitrary sequence of register
|
|
|
|
entries and memory entries, followed by an 'end' entry. */
|
|
|
|
|
|
|
|
static inline void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_exec_insn (struct regcache *regcache,
|
|
|
|
struct gdbarch *gdbarch,
|
|
|
|
struct record_full_entry *entry)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
switch (entry->type)
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_reg: /* reg */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-06-22 16:33:18 +02:00
|
|
|
gdb::byte_vector reg (entry->u.reg.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_reg %s to "
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
"inferior num = %d.\n",
|
|
|
|
host_address_to_string (entry),
|
|
|
|
entry->u.reg.num);
|
|
|
|
|
2018-05-30 20:54:38 +02:00
|
|
|
regcache->cooked_read (entry->u.reg.num, reg.data ());
|
2018-05-30 20:54:42 +02:00
|
|
|
regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
|
2017-06-22 16:33:18 +02:00
|
|
|
memcpy (record_full_get_loc (entry), reg.data (), entry->u.reg.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_mem: /* mem */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* Nothing to do if the entry is flagged not_accessible. */
|
|
|
|
if (!entry->u.mem.mem_entry_not_accessible)
|
|
|
|
{
|
2018-03-21 23:59:28 +01:00
|
|
|
gdb::byte_vector mem (entry->u.mem.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_mem %s to "
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
"inferior addr = %s len = %d.\n",
|
|
|
|
host_address_to_string (entry),
|
|
|
|
paddress (gdbarch, entry->u.mem.addr),
|
|
|
|
entry->u.mem.len);
|
|
|
|
|
|
|
|
if (record_read_memory (gdbarch,
|
2018-03-21 23:59:28 +01:00
|
|
|
entry->u.mem.addr, mem.data (),
|
|
|
|
entry->u.mem.len))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
entry->u.mem.mem_entry_not_accessible = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (target_write_memory (entry->u.mem.addr,
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_loc (entry),
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
entry->u.mem.len))
|
|
|
|
{
|
|
|
|
entry->u.mem.mem_entry_not_accessible = 1;
|
|
|
|
if (record_debug)
|
|
|
|
warning (_("Process record: error writing memory at "
|
|
|
|
"addr = %s len = %d."),
|
|
|
|
paddress (gdbarch, entry->u.mem.addr),
|
|
|
|
entry->u.mem.len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-21 23:59:28 +01:00
|
|
|
memcpy (record_full_get_loc (entry), mem.data (),
|
2013-03-11 09:44:14 +01:00
|
|
|
entry->u.mem.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* We've changed memory --- check if a hardware
|
|
|
|
watchpoint should trap. Note that this
|
|
|
|
presently assumes the target beneath supports
|
|
|
|
continuable watchpoints. On non-continuable
|
|
|
|
watchpoints target, we'll want to check this
|
|
|
|
_before_ actually doing the memory change, and
|
|
|
|
not doing the change at all if the watchpoint
|
|
|
|
traps. */
|
|
|
|
if (hardware_watchpoint_inserted_in_range
|
2017-11-02 16:15:41 +01:00
|
|
|
(regcache->aspace (),
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
entry->u.mem.addr, entry->u.mem.len))
|
2015-03-04 21:41:15 +01:00
|
|
|
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static void record_full_restore (void);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Asynchronous signal handle registered as event loop source for when
|
|
|
|
we have pending events ready to be passed to the core. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static struct async_event_handler *record_full_async_inferior_event_token;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_async_inferior_event_handler (gdb_client_data data)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2020-07-02 14:37:26 +02:00
|
|
|
inferior_event_handler (INF_REG_EVENT);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
/* Open the process record target for 'core' files. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
record_full_core_open_1 (const char *name, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
struct regcache *regcache = get_current_regcache ();
|
2017-10-25 17:37:03 +02:00
|
|
|
int regnum = gdbarch_num_regs (regcache->arch ());
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
int i;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Get record_full_core_regbuf. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
target_fetch_registers (regcache, -1);
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
record_full_core_regbuf = new detached_regcache (regcache->arch (), false);
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
for (i = 0; i < regnum; i ++)
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
record_full_core_regbuf->raw_supply (i, *regcache);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Get record_full_core_start and record_full_core_end. */
|
|
|
|
if (build_section_table (core_bfd, &record_full_core_start,
|
|
|
|
&record_full_core_end))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
delete record_full_core_regbuf;
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_core_regbuf = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("\"%s\": Can't find sections: %s"),
|
|
|
|
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
push_target (&record_full_core_ops);
|
|
|
|
record_full_restore ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
/* Open the process record target for 'live' processes. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
record_full_open_1 (const char *name, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (record_debug)
|
2016-11-29 03:34:54 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open_1\n");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* check exec */
|
|
|
|
if (!target_has_execution)
|
|
|
|
error (_("Process record: the program is not being run."));
|
|
|
|
if (non_stop)
|
|
|
|
error (_("Process record target can't debug inferior in non-stop mode "
|
|
|
|
"(non-stop)."));
|
|
|
|
|
|
|
|
if (!gdbarch_process_record_p (target_gdbarch ()))
|
|
|
|
error (_("Process record: the current architecture doesn't support "
|
|
|
|
"record function."));
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
push_target (&record_full_ops);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static void record_full_init_record_breakpoints (void);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
/* Open the process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
static void
|
|
|
|
record_full_open (const char *name, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (record_debug)
|
2013-03-11 09:44:14 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open\n");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Fix "is a record target open" checks.
RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use. This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.
To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack. Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.
That exercise then reveals other issues:
- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED. But, record_full_ calls shouldn't be made when
recording with the record-btrace target. So this adds a new
record_full_is_used predicate to be used in that spot.
- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target). record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does. The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.
Tested on x86_64 Fedora 17.
gdb/
2014-01-14 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* infrun.c (use_displaced_stepping): Use find_record_target
instead of RECORD_IS_USED.
(adjust_pc_after_break): Use record_full_is_used instead of
RECORD_IS_USED.
* record-btrace.c (record_btrace_open): Call record_preopen
instead of checking RECORD_IS_USED.
* record-full.c (record_full_shortname)
(record_full_core_shortname): New globals.
(record_full_is_used): New function.
(find_full_open): Call record_preopen instead of checking
RECORD_IS_USED.
(init_record_full_ops): Set the target's shortname to
record_full_shortname.
(init_record_full_core_ops): Set the target's shortname to
record_full_core_shortname.
* record-full.h (record_full_is_used): Declare.
* record.c (find_record_target): Make extern.
(record_preopen): New function.
* record.h (RECORD_IS_USED): Delete macro.
(find_record_target, record_preopen): Declare functions.
2014-01-14 17:12:19 +01:00
|
|
|
record_preopen ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Reset */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num = 0;
|
|
|
|
record_full_insn_count = 0;
|
|
|
|
record_full_list = &record_full_first;
|
|
|
|
record_full_list->next = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (core_bfd)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_core_open_1 (name, from_tty);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_open_1 (name, from_tty);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Register extra event sources in the event loop. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_async_inferior_event_token
|
|
|
|
= create_async_event_handler (record_full_async_inferior_event_handler,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
NULL);
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_init_record_breakpoints ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert observers to C++
This converts observers from using a special source-generating script
to be plain C++. This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).
Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.
Regression tested on the buildbot.
gdb/ChangeLog
2018-03-19 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* unittests/observable-selftests.c: New file.
* common/observable.h: New file.
* observable.h: New file.
* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
python/py-breakpoint.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
tui/tui-interp.c, valops.c: Update all users.
* tui/tui-hooks.c (tui_bp_created_observer)
(tui_bp_deleted_observer, tui_bp_modified_observer)
(tui_inferior_exit_observer, tui_before_prompt_observer)
(tui_normal_stop_observer, tui_register_changed_observer):
Remove.
(tui_observers_token): New global.
(attach_or_detach, tui_attach_detach_observers): New functions.
(tui_install_hooks, tui_remove_hooks): Use
tui_attach_detach_observers.
* record-btrace.c (record_btrace_thread_observer): Remove.
(record_btrace_thread_observer_token): New global.
* observer.sh: Remove.
* observer.c: Rename to observable.c.
* observable.c (namespace gdb_observers): Define new objects.
(observer_debug): Move into gdb_observers namespace.
(struct observer, struct observer_list, xalloc_observer_list_node)
(xfree_observer_list_node, generic_observer_attach)
(generic_observer_detach, generic_observer_notify): Remove.
(_initialize_observer): Update.
Don't include observer.inc.
* Makefile.in (generated_files): Remove observer.h, observer.inc.
(clean mostlyclean): Likewise.
(observer.h, observer.inc): Remove targets.
(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
(COMMON_SFILES): Use observable.c, not observer.c.
* .gitignore: Remove observer.h.
gdb/doc/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* observer.texi: Remove.
gdb/testsuite/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
|
|
|
gdb::observers::record_changed.notify (current_inferior (), 1, "full", NULL);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "close" target method. Close the process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::close ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_core_buf_entry *entry;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug)
|
2013-03-11 09:44:14 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_close\n");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Release record_full_core_regbuf. */
|
|
|
|
if (record_full_core_regbuf)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
delete record_full_core_regbuf;
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_core_regbuf = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Release record_full_core_buf_list. */
|
Fix leak in record-full.c
valgrind detects leaks in several gdb.reverse tests,
such as the below in gdb.reverse/watch-precsave.exp.
Fix the leak by rewriting the loop that frees
record_full_core_buf_list.
gdb/ChangeLog
2019-01-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* record-full.c (record_full_base_target::close): Rewrite
record_full_core_buf_list free logic.
==18847== VALGRIND_GDB_ERROR_BEGIN
==18847== 4,120 (24 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 3,094 of 3,199
==18847== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==18847== by 0x405097: xmalloc (common-utils.c:44)
==18847== by 0x5AF8EA: xnew<record_full_core_buf_entry> (poison.h:110)
==18847== by 0x5AF8EA: record_full_core_target::xfer_partial(target_object, char const*, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (record-full.c:2182)
==18847== by 0x64677D: raw_memory_xfer_partial(target_ops*, unsigned char*, unsigned char const*, unsigned long, long, unsigned long*) (target.c:956)
==18847== by 0x64691E: memory_xfer_partial_1(target_ops*, target_object, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (target.c:1086)
2019-01-01 14:12:30 +01:00
|
|
|
while (record_full_core_buf_list)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
Fix leak in record-full.c
valgrind detects leaks in several gdb.reverse tests,
such as the below in gdb.reverse/watch-precsave.exp.
Fix the leak by rewriting the loop that frees
record_full_core_buf_list.
gdb/ChangeLog
2019-01-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* record-full.c (record_full_base_target::close): Rewrite
record_full_core_buf_list free logic.
==18847== VALGRIND_GDB_ERROR_BEGIN
==18847== 4,120 (24 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 3,094 of 3,199
==18847== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==18847== by 0x405097: xmalloc (common-utils.c:44)
==18847== by 0x5AF8EA: xnew<record_full_core_buf_entry> (poison.h:110)
==18847== by 0x5AF8EA: record_full_core_target::xfer_partial(target_object, char const*, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (record-full.c:2182)
==18847== by 0x64677D: raw_memory_xfer_partial(target_ops*, unsigned char*, unsigned char const*, unsigned long, long, unsigned long*) (target.c:956)
==18847== by 0x64691E: memory_xfer_partial_1(target_ops*, target_object, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (target.c:1086)
2019-01-01 14:12:30 +01:00
|
|
|
entry = record_full_core_buf_list;
|
|
|
|
record_full_core_buf_list = record_full_core_buf_list->prev;
|
|
|
|
xfree (entry);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_async_inferior_event_token)
|
|
|
|
delete_async_event_handler (&record_full_async_inferior_event_token);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "async" target method. */
|
When disabling target async, remove all target event sources from the event loop
The sigall-reverse.exp test occasionally fails with something like this:
(gdb) PASS: gdb.reverse/sigall-reverse.exp: send signal TERM
continue
Continuing.
The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to handler of TERM (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to gen_TERM (timeout)
This is another event-loop/async related problem exposed by the patch
that made 'query' use gdb_readline_wrapper (588dcc3edbde19f9).
The problem is that even though gdb_readline_wrapper disables
target-async while the secondary prompt is in progress, the record
target's async event source is left marked. So when
gdb_readline_wrapper nests an event loop to process input, it may
happen that that event loop ends up processing a target event while
GDB is not really ready for it. Here's the relevant part of the
backtrace showing the root issue in action:
...
#14 0x000000000061cb48 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:4158
#15 0x0000000000642917 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:57
#16 0x000000000077ca5c in record_full_async_inferior_event_handler (data=0x0) at src/gdb/record-full.c:791
#17 0x0000000000640fdf in invoke_async_event_handler (data=...) at src/gdb/event-loop.c:1067
#18 0x000000000063fb01 in process_event () at src/gdb/event-loop.c:339
#19 0x000000000063fb2a in gdb_do_one_event () at src/gdb/event-loop.c:360
#20 0x000000000074d607 in gdb_readline_wrapper (prompt=0x3588f40 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) ") at src/gdb/top.c:842
#21 0x0000000000750bd9 in defaulted_query (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?", defchar=121 'y', args=0x7fff70524410) at src/gdb/utils.c:1279
#22 0x0000000000750e4c in yquery (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?") at src/gdb/utils.c:1358
#23 0x00000000004b020e in record_linux_system_call (syscall=gdb_sys_exit_group, regcache=0x3529450, tdep=0xd6c840 <amd64_linux_record_tdep>) at src/gdb/linux-record.c:1933
With my all-stop-on-top-of-non-stop series, I'm also seeing
gdb.server/ext-attach.exp fail occasionally due to the same issue.
The first part of the fix is for target_async implementations to make
sure to remove/unmark all target-related event sources from the event
loop.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2015-02-03 Pedro Alves <palves@redhat.com>
* event-loop.c (clear_async_event_handler): New function.
* event-loop.h (clear_async_event_handler): New declaration.
* record-btrace.c (record_btrace_async): New function.
(init_record_btrace_ops): Install record_btrace_async.
* record-full.c (record_full_async): New function.
(record_full_resume): Don't mark the async event source here.
(init_record_full_ops): Install record_full_async.
(record_full_core_resume): Don't mark the async event source here.
(init_record_full_core_ops): Install record_full_async.
* remote.c (remote_async): Mark and clear the async stop reply
queue event-loop token as appropriate.
2015-02-03 16:07:54 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::async (int enable)
|
When disabling target async, remove all target event sources from the event loop
The sigall-reverse.exp test occasionally fails with something like this:
(gdb) PASS: gdb.reverse/sigall-reverse.exp: send signal TERM
continue
Continuing.
The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to handler of TERM (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to gen_TERM (timeout)
This is another event-loop/async related problem exposed by the patch
that made 'query' use gdb_readline_wrapper (588dcc3edbde19f9).
The problem is that even though gdb_readline_wrapper disables
target-async while the secondary prompt is in progress, the record
target's async event source is left marked. So when
gdb_readline_wrapper nests an event loop to process input, it may
happen that that event loop ends up processing a target event while
GDB is not really ready for it. Here's the relevant part of the
backtrace showing the root issue in action:
...
#14 0x000000000061cb48 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:4158
#15 0x0000000000642917 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:57
#16 0x000000000077ca5c in record_full_async_inferior_event_handler (data=0x0) at src/gdb/record-full.c:791
#17 0x0000000000640fdf in invoke_async_event_handler (data=...) at src/gdb/event-loop.c:1067
#18 0x000000000063fb01 in process_event () at src/gdb/event-loop.c:339
#19 0x000000000063fb2a in gdb_do_one_event () at src/gdb/event-loop.c:360
#20 0x000000000074d607 in gdb_readline_wrapper (prompt=0x3588f40 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) ") at src/gdb/top.c:842
#21 0x0000000000750bd9 in defaulted_query (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?", defchar=121 'y', args=0x7fff70524410) at src/gdb/utils.c:1279
#22 0x0000000000750e4c in yquery (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?") at src/gdb/utils.c:1358
#23 0x00000000004b020e in record_linux_system_call (syscall=gdb_sys_exit_group, regcache=0x3529450, tdep=0xd6c840 <amd64_linux_record_tdep>) at src/gdb/linux-record.c:1933
With my all-stop-on-top-of-non-stop series, I'm also seeing
gdb.server/ext-attach.exp fail occasionally due to the same issue.
The first part of the fix is for target_async implementations to make
sure to remove/unmark all target-related event sources from the event
loop.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2015-02-03 Pedro Alves <palves@redhat.com>
* event-loop.c (clear_async_event_handler): New function.
* event-loop.h (clear_async_event_handler): New declaration.
* record-btrace.c (record_btrace_async): New function.
(init_record_btrace_ops): Install record_btrace_async.
* record-full.c (record_full_async): New function.
(record_full_resume): Don't mark the async event source here.
(init_record_full_ops): Install record_full_async.
(record_full_core_resume): Don't mark the async event source here.
(init_record_full_core_ops): Install record_full_async.
* remote.c (remote_async): Mark and clear the async stop reply
queue event-loop token as appropriate.
2015-02-03 16:07:54 +01:00
|
|
|
{
|
Simplify target_async hook interface
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
2015-03-25 12:28:31 +01:00
|
|
|
if (enable)
|
When disabling target async, remove all target event sources from the event loop
The sigall-reverse.exp test occasionally fails with something like this:
(gdb) PASS: gdb.reverse/sigall-reverse.exp: send signal TERM
continue
Continuing.
The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to handler of TERM (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to gen_TERM (timeout)
This is another event-loop/async related problem exposed by the patch
that made 'query' use gdb_readline_wrapper (588dcc3edbde19f9).
The problem is that even though gdb_readline_wrapper disables
target-async while the secondary prompt is in progress, the record
target's async event source is left marked. So when
gdb_readline_wrapper nests an event loop to process input, it may
happen that that event loop ends up processing a target event while
GDB is not really ready for it. Here's the relevant part of the
backtrace showing the root issue in action:
...
#14 0x000000000061cb48 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:4158
#15 0x0000000000642917 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:57
#16 0x000000000077ca5c in record_full_async_inferior_event_handler (data=0x0) at src/gdb/record-full.c:791
#17 0x0000000000640fdf in invoke_async_event_handler (data=...) at src/gdb/event-loop.c:1067
#18 0x000000000063fb01 in process_event () at src/gdb/event-loop.c:339
#19 0x000000000063fb2a in gdb_do_one_event () at src/gdb/event-loop.c:360
#20 0x000000000074d607 in gdb_readline_wrapper (prompt=0x3588f40 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) ") at src/gdb/top.c:842
#21 0x0000000000750bd9 in defaulted_query (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?", defchar=121 'y', args=0x7fff70524410) at src/gdb/utils.c:1279
#22 0x0000000000750e4c in yquery (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?") at src/gdb/utils.c:1358
#23 0x00000000004b020e in record_linux_system_call (syscall=gdb_sys_exit_group, regcache=0x3529450, tdep=0xd6c840 <amd64_linux_record_tdep>) at src/gdb/linux-record.c:1933
With my all-stop-on-top-of-non-stop series, I'm also seeing
gdb.server/ext-attach.exp fail occasionally due to the same issue.
The first part of the fix is for target_async implementations to make
sure to remove/unmark all target-related event sources from the event
loop.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2015-02-03 Pedro Alves <palves@redhat.com>
* event-loop.c (clear_async_event_handler): New function.
* event-loop.h (clear_async_event_handler): New declaration.
* record-btrace.c (record_btrace_async): New function.
(init_record_btrace_ops): Install record_btrace_async.
* record-full.c (record_full_async): New function.
(record_full_resume): Don't mark the async event source here.
(init_record_full_ops): Install record_full_async.
(record_full_core_resume): Don't mark the async event source here.
(init_record_full_core_ops): Install record_full_async.
* remote.c (remote_async): Mark and clear the async stop reply
queue event-loop token as appropriate.
2015-02-03 16:07:54 +01:00
|
|
|
mark_async_event_handler (record_full_async_inferior_event_token);
|
|
|
|
else
|
|
|
|
clear_async_event_handler (record_full_async_inferior_event_token);
|
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
beneath ()->async (enable);
|
When disabling target async, remove all target event sources from the event loop
The sigall-reverse.exp test occasionally fails with something like this:
(gdb) PASS: gdb.reverse/sigall-reverse.exp: send signal TERM
continue
Continuing.
The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to handler of TERM (timeout)
FAIL: gdb.reverse/sigall-reverse.exp: reverse to gen_TERM (timeout)
This is another event-loop/async related problem exposed by the patch
that made 'query' use gdb_readline_wrapper (588dcc3edbde19f9).
The problem is that even though gdb_readline_wrapper disables
target-async while the secondary prompt is in progress, the record
target's async event source is left marked. So when
gdb_readline_wrapper nests an event loop to process input, it may
happen that that event loop ends up processing a target event while
GDB is not really ready for it. Here's the relevant part of the
backtrace showing the root issue in action:
...
#14 0x000000000061cb48 in fetch_inferior_event (client_data=0x0) at src/gdb/infrun.c:4158
#15 0x0000000000642917 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at src/gdb/inf-loop.c:57
#16 0x000000000077ca5c in record_full_async_inferior_event_handler (data=0x0) at src/gdb/record-full.c:791
#17 0x0000000000640fdf in invoke_async_event_handler (data=...) at src/gdb/event-loop.c:1067
#18 0x000000000063fb01 in process_event () at src/gdb/event-loop.c:339
#19 0x000000000063fb2a in gdb_do_one_event () at src/gdb/event-loop.c:360
#20 0x000000000074d607 in gdb_readline_wrapper (prompt=0x3588f40 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?([y] or n) ") at src/gdb/top.c:842
#21 0x0000000000750bd9 in defaulted_query (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?", defchar=121 'y', args=0x7fff70524410) at src/gdb/utils.c:1279
#22 0x0000000000750e4c in yquery (ctlstr=0x8c6588 "The next instruction is syscall exit_group. It will make the program exit. Do you want to stop the program?") at src/gdb/utils.c:1358
#23 0x00000000004b020e in record_linux_system_call (syscall=gdb_sys_exit_group, regcache=0x3529450, tdep=0xd6c840 <amd64_linux_record_tdep>) at src/gdb/linux-record.c:1933
With my all-stop-on-top-of-non-stop series, I'm also seeing
gdb.server/ext-attach.exp fail occasionally due to the same issue.
The first part of the fix is for target_async implementations to make
sure to remove/unmark all target-related event sources from the event
loop.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2015-02-03 Pedro Alves <palves@redhat.com>
* event-loop.c (clear_async_event_handler): New function.
* event-loop.h (clear_async_event_handler): New declaration.
* record-btrace.c (record_btrace_async): New function.
(init_record_btrace_ops): Install record_btrace_async.
* record-full.c (record_full_async): New function.
(record_full_resume): Don't mark the async event source here.
(init_record_full_ops): Install record_full_async.
(record_full_core_resume): Don't mark the async event source here.
(init_record_full_core_ops): Install record_full_async.
* remote.c (remote_async): Mark and clear the async stop reply
queue event-loop token as appropriate.
2015-02-03 16:07:54 +01:00
|
|
|
}
|
|
|
|
|
2020-01-10 21:05:41 +01:00
|
|
|
/* The PTID and STEP arguments last passed to
|
|
|
|
record_full_target::resume. */
|
|
|
|
static ptid_t record_full_resume_ptid = null_ptid;
|
2013-03-11 09:44:14 +01:00
|
|
|
static int record_full_resume_step = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* True if we've been resumed, and so each record_full_wait call should
|
|
|
|
advance execution. If this is false, record_full_wait will return a
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
TARGET_WAITKIND_IGNORE. */
|
2013-03-11 09:44:14 +01:00
|
|
|
static int record_full_resumed = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* The execution direction of the last resume we got. This is
|
|
|
|
necessary for async mode. Vis (order is not strictly accurate):
|
|
|
|
|
|
|
|
1. user has the global execution direction set to forward
|
|
|
|
2. user does a reverse-step command
|
2013-03-11 09:44:14 +01:00
|
|
|
3. record_full_resume is called with global execution direction
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
temporarily switched to reverse
|
|
|
|
4. GDB's execution direction is reverted back to forward
|
|
|
|
5. target record notifies event loop there's an event to handle
|
|
|
|
6. infrun asks the target which direction was it going, and switches
|
|
|
|
the global execution direction accordingly (to reverse)
|
|
|
|
7. infrun polls an event out of the record target, and handles it
|
|
|
|
8. GDB goes back to the event loop, and goto #4.
|
|
|
|
*/
|
2013-03-11 09:44:14 +01:00
|
|
|
static enum exec_direction_kind record_full_execution_dir = EXEC_FORWARD;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "resume" target method. Resume the process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2020-01-10 21:05:41 +01:00
|
|
|
record_full_resume_ptid = inferior_ptid;
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_resume_step = step;
|
|
|
|
record_full_resumed = 1;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_execution_dir = ::execution_direction;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = target_thread_architecture (ptid);
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_message (get_current_regcache (), signal);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (!step)
|
|
|
|
{
|
|
|
|
/* This is not hard single step. */
|
|
|
|
if (!gdbarch_software_single_step_p (gdbarch))
|
|
|
|
{
|
|
|
|
/* This is a normal continue. */
|
|
|
|
step = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-25 15:41:58 +01:00
|
|
|
/* This arch supports soft single step. */
|
2014-10-15 21:18:32 +02:00
|
|
|
if (thread_has_single_step_breakpoints_set (inferior_thread ()))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* This is a soft single step. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_resume_step = 1;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
2016-11-08 15:28:32 +01:00
|
|
|
step = !insert_single_step_breakpoints (gdbarch);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the target beneath reports all signals. */
|
target_pass_signals/target_program_signals: Use gdb::array_view
This replaces the pointer and length parameters of target_pass_signals
and target_program_signals with a gdb::array_view parameter, and fixes
the fallout.
In infrun.c, the signal_stop, signal_print, signal_program,
signal_catch, signal_pass globals are currently pointers to
heap-allocated memory. I see no point in that, so I converted them to
arrays. This allows simplifying the calls to
target_pass_signals/target_program_signals, since we can pass the
array directly, which can implicitly convert to gdb::array_view.
gdb/ChangeLog:
2019-01-24 Pedro Alves <palves@redhat.com>
* infrun.c (signal_stop, signal_print, signal_program)
(signal_catch, signal_pass): Now arrays instead of pointers.
(update_signals_program_target, do_target_resume)
(signal_catch_update, handle_command, _initialize_infrun): Adjust.
* linux-nat.c (linux_nat_target::pass_signals)
(linux_nat_target::create_inferior, linux_nat_target::attach):
Adjust.
* linux-nat.h (linux_nat_target::pass_signals): Adjust.
* nto-procfs.c (nto_procfs_target::pass_signals): Adjust.
* procfs.c (procfs_target::pass_signals): Adjust.
* record-full.c (record_full_target::resume): Adjust.
* remote.c (remote_target::pass_signals)
(remote_target::program_signals): Adjust.
* target-debug.h (target_debug_print_signals): Now takes a
gdb::array_view as parameter. Adjust.
* target.h (target_ops) <pass_signals, program_signals>: Replace
pointer and length parameters with gdb::array_view.
(target_pass_signals, target_program_signals): Likewise.
* target-delegates.c: Regenerate.
2019-01-24 19:25:06 +01:00
|
|
|
target_pass_signals ({});
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
this->beneath ()->resume (ptid, step, signal);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We are about to start executing the inferior (or simulate it),
|
|
|
|
let's register it with the event loop. */
|
|
|
|
if (target_can_async_p ())
|
Simplify target_async hook interface
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
2015-03-25 12:28:31 +01:00
|
|
|
target_async (1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "commit_resume" method for process record target. */
|
gdb: Coalesce/aggregate (async) vCont packets/actions
Currently, with "maint set target-non-stop on", that is, when gdb
connects with the non-stop/asynchronous variant of the remote
protocol, even with "set non-stop off", GDB always sends one vCont
packet per thread resumed. This patch makes GDB aggregate and
coalesce vCont packets, so we send vCont packets like "vCont;s:p1.1;c"
in non-stop mode too.
Basically, this is done by:
- Adding a new target method target_commit_resume that is called
after calling target_resume one or more times. When resuming a
batch of threads, we'll only call target_commit_resume once after
calling target_resume for all threads.
- Making the remote target defer sending the actual vCont packet to
target_commit_resume.
Special care must be taken to avoid sending a vCont action with a
"wildcard" thread-id (all threads of process / all threads) when that
would resume threads/processes that should not be resumed. See
remote_commit_resume comments for details.
Unlike all-stop's remote_resume implementation, this handles the case
of too many actions resulting in a too-big vCont packet, by flushing
the vCont packet and starting a new one.
E.g., imagining that the "c" action in:
vCont;s:1;c
overflows the packet buffer, we split the actions like:
vCont;s:1
vCont;c
Tested on x86_64 Fedora 20, with and without "maint set
target-non-stop on".
Also tested with a hack that makes remote_commit_resume flush the vCont
packet after every action appended (which caught a few bugs).
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.h (ALL_NON_EXITED_INFERIORS): New macro.
* infrun.c (do_target_resume): Call target_commit_resume.
(proceed): Defer target_commit_resume while looping over threads,
resuming them. Call target_commit_resume at the end.
* record-btrace.c (record_btrace_commit_resume): New function.
(init_record_btrace_ops): Install it as to_commit_resume method.
* record-full.c (record_full_commit_resume): New function.
(record_full_wait_1): Call the beneath target's to_commit_resume
method.
(init_record_full_ops): Install record_full_commit_resume as
to_commit_resume method.
* remote.c (struct private_thread_info) <last_resume_step,
last_resume_sig, vcont_resumed>: New fields.
(remote_add_thread): Set the new thread's vcont_resumed flag.
(demand_private_info): Delete.
(get_private_info_thread, get_private_info_ptid): New functions.
(remote_update_thread_list): Adjust.
(process_initial_stop_replies): Clear the thread's vcont_resumed
flag.
(remote_resume): If connected in non-stop mode, record the resume
request and return early.
(struct private_inferior): New.
(struct vcont_builder): New.
(vcont_builder_restart, vcont_builder_flush)
(vcont_builder_push_action): New functions.
(MAX_ACTION_SIZE): New macro.
(remote_commit_resume): New function.
(thread_pending_fork_status, is_pending_fork_parent_thread): New
functions.
(check_pending_event_prevents_wildcard_vcont_callback)
(check_pending_events_prevent_wildcard_vcont): New functions.
(process_stop_reply): Adjust. Clear the thread's vcont_resumed
flag.
(init_remote_ops): Install remote_commit_resume.
* target-delegates.c: Regenerate.
* target.c (defer_target_commit_resume): New global.
(target_commit_resume, make_cleanup_defer_target_commit_resume):
New functions.
* target.h (struct target_ops) <to_commit_resume>: New field.
(target_resume): Update comments.
(target_commit_resume): New declaration.
2016-10-26 12:08:28 +02:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_target::commit_resume ()
|
gdb: Coalesce/aggregate (async) vCont packets/actions
Currently, with "maint set target-non-stop on", that is, when gdb
connects with the non-stop/asynchronous variant of the remote
protocol, even with "set non-stop off", GDB always sends one vCont
packet per thread resumed. This patch makes GDB aggregate and
coalesce vCont packets, so we send vCont packets like "vCont;s:p1.1;c"
in non-stop mode too.
Basically, this is done by:
- Adding a new target method target_commit_resume that is called
after calling target_resume one or more times. When resuming a
batch of threads, we'll only call target_commit_resume once after
calling target_resume for all threads.
- Making the remote target defer sending the actual vCont packet to
target_commit_resume.
Special care must be taken to avoid sending a vCont action with a
"wildcard" thread-id (all threads of process / all threads) when that
would resume threads/processes that should not be resumed. See
remote_commit_resume comments for details.
Unlike all-stop's remote_resume implementation, this handles the case
of too many actions resulting in a too-big vCont packet, by flushing
the vCont packet and starting a new one.
E.g., imagining that the "c" action in:
vCont;s:1;c
overflows the packet buffer, we split the actions like:
vCont;s:1
vCont;c
Tested on x86_64 Fedora 20, with and without "maint set
target-non-stop on".
Also tested with a hack that makes remote_commit_resume flush the vCont
packet after every action appended (which caught a few bugs).
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.h (ALL_NON_EXITED_INFERIORS): New macro.
* infrun.c (do_target_resume): Call target_commit_resume.
(proceed): Defer target_commit_resume while looping over threads,
resuming them. Call target_commit_resume at the end.
* record-btrace.c (record_btrace_commit_resume): New function.
(init_record_btrace_ops): Install it as to_commit_resume method.
* record-full.c (record_full_commit_resume): New function.
(record_full_wait_1): Call the beneath target's to_commit_resume
method.
(init_record_full_ops): Install record_full_commit_resume as
to_commit_resume method.
* remote.c (struct private_thread_info) <last_resume_step,
last_resume_sig, vcont_resumed>: New fields.
(remote_add_thread): Set the new thread's vcont_resumed flag.
(demand_private_info): Delete.
(get_private_info_thread, get_private_info_ptid): New functions.
(remote_update_thread_list): Adjust.
(process_initial_stop_replies): Clear the thread's vcont_resumed
flag.
(remote_resume): If connected in non-stop mode, record the resume
request and return early.
(struct private_inferior): New.
(struct vcont_builder): New.
(vcont_builder_restart, vcont_builder_flush)
(vcont_builder_push_action): New functions.
(MAX_ACTION_SIZE): New macro.
(remote_commit_resume): New function.
(thread_pending_fork_status, is_pending_fork_parent_thread): New
functions.
(check_pending_event_prevents_wildcard_vcont_callback)
(check_pending_events_prevent_wildcard_vcont): New functions.
(process_stop_reply): Adjust. Clear the thread's vcont_resumed
flag.
(init_remote_ops): Install remote_commit_resume.
* target-delegates.c: Regenerate.
* target.c (defer_target_commit_resume): New global.
(target_commit_resume, make_cleanup_defer_target_commit_resume):
New functions.
* target.h (struct target_ops) <to_commit_resume>: New field.
(target_resume): Update comments.
(target_commit_resume): New declaration.
2016-10-26 12:08:28 +02:00
|
|
|
{
|
|
|
|
if (!RECORD_FULL_IS_REPLAY)
|
2018-06-07 18:27:47 +02:00
|
|
|
beneath ()->commit_resume ();
|
gdb: Coalesce/aggregate (async) vCont packets/actions
Currently, with "maint set target-non-stop on", that is, when gdb
connects with the non-stop/asynchronous variant of the remote
protocol, even with "set non-stop off", GDB always sends one vCont
packet per thread resumed. This patch makes GDB aggregate and
coalesce vCont packets, so we send vCont packets like "vCont;s:p1.1;c"
in non-stop mode too.
Basically, this is done by:
- Adding a new target method target_commit_resume that is called
after calling target_resume one or more times. When resuming a
batch of threads, we'll only call target_commit_resume once after
calling target_resume for all threads.
- Making the remote target defer sending the actual vCont packet to
target_commit_resume.
Special care must be taken to avoid sending a vCont action with a
"wildcard" thread-id (all threads of process / all threads) when that
would resume threads/processes that should not be resumed. See
remote_commit_resume comments for details.
Unlike all-stop's remote_resume implementation, this handles the case
of too many actions resulting in a too-big vCont packet, by flushing
the vCont packet and starting a new one.
E.g., imagining that the "c" action in:
vCont;s:1;c
overflows the packet buffer, we split the actions like:
vCont;s:1
vCont;c
Tested on x86_64 Fedora 20, with and without "maint set
target-non-stop on".
Also tested with a hack that makes remote_commit_resume flush the vCont
packet after every action appended (which caught a few bugs).
gdb/ChangeLog:
2016-10-26 Pedro Alves <palves@redhat.com>
* inferior.h (ALL_NON_EXITED_INFERIORS): New macro.
* infrun.c (do_target_resume): Call target_commit_resume.
(proceed): Defer target_commit_resume while looping over threads,
resuming them. Call target_commit_resume at the end.
* record-btrace.c (record_btrace_commit_resume): New function.
(init_record_btrace_ops): Install it as to_commit_resume method.
* record-full.c (record_full_commit_resume): New function.
(record_full_wait_1): Call the beneath target's to_commit_resume
method.
(init_record_full_ops): Install record_full_commit_resume as
to_commit_resume method.
* remote.c (struct private_thread_info) <last_resume_step,
last_resume_sig, vcont_resumed>: New fields.
(remote_add_thread): Set the new thread's vcont_resumed flag.
(demand_private_info): Delete.
(get_private_info_thread, get_private_info_ptid): New functions.
(remote_update_thread_list): Adjust.
(process_initial_stop_replies): Clear the thread's vcont_resumed
flag.
(remote_resume): If connected in non-stop mode, record the resume
request and return early.
(struct private_inferior): New.
(struct vcont_builder): New.
(vcont_builder_restart, vcont_builder_flush)
(vcont_builder_push_action): New functions.
(MAX_ACTION_SIZE): New macro.
(remote_commit_resume): New function.
(thread_pending_fork_status, is_pending_fork_parent_thread): New
functions.
(check_pending_event_prevents_wildcard_vcont_callback)
(check_pending_events_prevent_wildcard_vcont): New functions.
(process_stop_reply): Adjust. Clear the thread's vcont_resumed
flag.
(init_remote_ops): Install remote_commit_resume.
* target-delegates.c: Regenerate.
* target.c (defer_target_commit_resume): New global.
(target_commit_resume, make_cleanup_defer_target_commit_resume):
New functions.
* target.h (struct target_ops) <to_commit_resume>: New field.
(target_resume): Update comments.
(target_commit_resume): New declaration.
2016-10-26 12:08:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
static int record_full_get_sig = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* SIGINT signal handler, registered by "wait" method. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_sig_handler (int signo)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "Process record: get a signal\n");
|
|
|
|
|
|
|
|
/* It will break the running inferior in replay mode. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_resume_step = 1;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* It will let record_full_wait set inferior status to get the signal
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
SIGINT. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_sig = 1;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "wait" target method for process record target.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
In record mode, the target is always run in singlestep mode
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
(even when gdb says to continue). The wait method intercepts
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
the stop events and determines which ones are to be passed on to
|
|
|
|
gdb. Most stop events are just singlestep events that gdb is not
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
to know about, so the wait method just records them and keeps
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
singlestepping.
|
|
|
|
|
|
|
|
In replay mode, this function emulates the recorded execution log,
|
|
|
|
one instruction at a time (forward or backward), and determines
|
|
|
|
where to stop. */
|
|
|
|
|
|
|
|
static ptid_t
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_wait_1 (struct target_ops *ops,
|
|
|
|
ptid_t ptid, struct target_waitstatus *status,
|
|
|
|
int options)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore restore_operation_disable
|
|
|
|
= record_full_gdb_operation_disable_set ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_wait "
|
|
|
|
"record_full_resume_step = %d, "
|
|
|
|
"record_full_resumed = %d, direction=%s\n",
|
|
|
|
record_full_resume_step, record_full_resumed,
|
|
|
|
record_full_execution_dir == EXEC_FORWARD
|
|
|
|
? "forward" : "reverse");
|
|
|
|
|
|
|
|
if (!record_full_resumed)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
gdb_assert ((options & TARGET_WNOHANG) != 0);
|
|
|
|
|
|
|
|
/* No interesting event. */
|
|
|
|
status->kind = TARGET_WAITKIND_IGNORE;
|
|
|
|
return minus_one_ptid;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_sig = 0;
|
|
|
|
signal (SIGINT, record_full_sig_handler);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2015-03-04 21:41:15 +01:00
|
|
|
record_full_stop_reason = TARGET_STOPPED_BY_NO_REASON;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!RECORD_FULL_IS_REPLAY && ops != &record_full_core_ops)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_resume_step)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* This is a single step. */
|
2018-06-07 18:27:47 +02:00
|
|
|
return ops->beneath ()->wait (ptid, status, options);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* This is not a single step. */
|
|
|
|
ptid_t ret;
|
|
|
|
CORE_ADDR tmp_pc;
|
2020-01-10 21:05:41 +01:00
|
|
|
struct gdbarch *gdbarch
|
|
|
|
= target_thread_architecture (record_full_resume_ptid);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2018-06-07 18:27:47 +02:00
|
|
|
ret = ops->beneath ()->wait (ptid, status, options);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (status->kind == TARGET_WAITKIND_IGNORE)
|
|
|
|
{
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_wait "
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
"target beneath not done yet\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.
As preparation for multi-target, this patch makes each inferior have
its own thread list.
This isn't absolutely necessary for multi-target, but simplifies
things. It originally stemmed from the desire to eliminate the
init_thread_list calls sprinkled around, plus it makes it more
efficient to iterate over threads of a given inferior (no need to
always iterate over threads of all inferiors).
We still need to iterate over threads of all inferiors in a number of
places, which means we'd need adjust the ALL_THREADS /
ALL_NON_EXITED_THREADS macros. However, naively tweaking those macros
to have an extra for loop, like:
#define ALL_THREADS (thr, inf) \
for (inf = inferior_list; inf; inf = inf->next) \
for (thr = inf->thread_list; thr; thr = thr->next)
causes problems with code that does "break" or "continue" within the
ALL_THREADS loop body. Plus, we need to declare the extra "inf" local
variable in order to pass it as temporary variable to ALL_THREADS
(etc.)
It gets even trickier when we consider extending the macros to filter
out threads matching a ptid_t and a target. The macros become tricker
to read/write. Been there.
An alternative (which was my next attempt), is to replace the
ALL_THREADS etc. iteration style with for_each_all_threads,
for_each_non_exited_threads, etc. functions which would take a
callback as parameter, which would usually be passed a lambda.
However, I did not find that satisfactory at all, because the
resulting code ends up a little less natural / more noisy to read,
write and debug/step-through (due to use of lambdas), and in many
places where we use "continue;" to skip to the next thread now need to
use "return;". (I ran into hard to debug bugs caused by a
continue/return confusion.)
I.e., before:
ALL_NON_EXITED_THREADS (tp)
{
if (tp->not_what_I_want)
continue;
// do something
}
would turn into:
for_each_non_exited_thread ([&] (thread_info *tp)
{
if (tp->not_what_I_want)
return;
// do something
});
Lastly, the solution I settled with was to replace the ALL_THREADS /
ALL_NON_EXITED_THREADS / ALL_INFERIORS macros with (C++20-like) ranges
and iterators, such that you can instead naturaly iterate over
threads/inferiors using range-for, like e.g,.:
// all threads, including THREAD_EXITED threads.
for (thread_info *tp : all_threads ())
{ .... }
// all non-exited threads.
for (thread_info *tp : all_non_exited_threads ())
{ .... }
// all non-exited threads of INF inferior.
for (thread_info *tp : inf->non_exited_threads ())
{ .... }
The all_non_exited_threads() function takes an optional filter ptid_t as
parameter, which is quite convenient when we need to iterate over
threads matching that filter. See e.g., how the
set_executing/set_stop_requested/finish_thread_state etc. functions in
thread.c end up being simplified.
Most of the patch thus is about adding the infrustructure for allowing
the above. Later on when we get to actual multi-target, these
functions/ranges/iterators will gain a "target_ops *" parameter so
that e.g., we can iterate over all threads of a given target that
match a given filter ptid_t.
The only entry points users needs to be aware of are the
all_threads/all_non_exited_threads etc. functions seen above. Thus,
those functions are declared in gdbthread.h/inferior.h. The actual
iterators/ranges are mainly "internals" and thus are put out of view
in the new thread-iter.h/thread-iter.c/inferior-iter.h files. That
keeps the gdbthread.h/inferior.h headers quite a bit more readable.
A common/safe-iterator.h header is added which adds a template that
can be used to build "safe" iterators, which are forward iterators
that can be used to replace the ALL_THREADS_SAFE macro and other
instances of the same idiom in future.
There's a little bit of shuffling of code between
gdbthread.h/thread.c/inferior.h in the patch. That is necessary in
order to avoid circular dependencies between the
gdbthread.h/inferior.h headers.
As for the init_thread_list calls sprinkled around, they're all
eliminated by this patch, and a new, central call is added to
inferior_appeared. Note how also related to that, there's a call to
init_wait_for_inferior in remote.c that is eliminated.
init_wait_for_inferior is currently responsible for discarding skipped
inline frames, which had to be moved elsewhere. Given that nowadays
we always have a thread even for single-threaded processes, the
natural place is to delete a frame's inline frame info when we delete
the thread. I.e., from clear_thread_inferior_resources.
gdb/ChangeLog:
2018-11-22 Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_SFILES): Add thread-iter.c.
* breakpoint.c (breakpoints_should_be_inserted_now): Replace
ALL_NON_EXITED_THREADS with all_non_exited_threads.
(print_one_breakpoint_location): Replace ALL_INFERIORS with
all_inferiors.
* bsd-kvm.c: Include inferior.h.
* btrace.c (btrace_free_objfile): Replace ALL_NON_EXITED_THREADS
with all_non_exited_threads.
* common/filtered-iterator.h: New.
* common/safe-iterator.h: New.
* corelow.c (core_target_open): Don't call init_thread_list here.
* darwin-nat.c (thread_info_from_private_thread_info): Replace
ALL_THREADS with all_threads.
* fbsd-nat.c (fbsd_nat_target::resume): Replace
ALL_NON_EXITED_THREADS with inf->non_exited_threads.
* fbsd-tdep.c (fbsd_make_corefile_notes): Replace
ALL_NON_EXITED_THREADS with inf->non_exited_threads.
* fork-child.c (postfork_hook): Don't call init_thread_list here.
* gdbarch-selftests.c (register_to_value_test): Adjust.
* gdbthread.h: Don't include "inferior.h" here.
(struct inferior): Forward declare.
(enum step_over_calls_kind): Moved here from inferior.h.
(thread_info::deletable): Definition moved to thread.c.
(find_thread_ptid (inferior *, ptid_t)): Declare.
(ALL_THREADS, ALL_THREADS_BY_INFERIOR, ALL_THREADS_SAFE): Delete.
Include "thread-iter.h".
(all_threads, all_non_exited_threads, all_threads_safe): New.
(any_thread_p): Declare.
(thread_list): Delete.
* infcmd.c (signal_command): Replace ALL_NON_EXITED_THREADS with
all_non_exited_threads.
(proceed_after_attach_callback): Delete.
(proceed_after_attach): Take an inferior pointer instead of an
integer PID. Adjust to use range-for.
(attach_post_wait): Pass down inferior pointer instead of pid.
Use range-for instead of ALL_NON_EXITED_THREADS.
(detach_command): Remove init_thread_list call.
* inferior-iter.h: New.
* inferior.c (struct delete_thread_of_inferior_arg): Delete.
(delete_thread_of_inferior): Delete.
(delete_inferior, exit_inferior_1): Use range-for with
inf->threads_safe() instead of iterate_over_threads.
(inferior_appeared): Call init_thread_list here.
(discard_all_inferiors): Use all_non_exited_inferiors.
(find_inferior_id, find_inferior_pid): Use all_inferiors.
(iterate_over_inferiors): Use all_inferiors_safe.
(have_inferiors, number_of_live_inferiors): Use
all_non_exited_inferiors.
(number_of_inferiors): Use all_inferiors and std::distance.
(print_inferior): Use all_inferiors.
* inferior.h: Include gdbthread.h.
(enum step_over_calls_kind): Moved to gdbthread.h.
(struct inferior) <thread_list>: New field.
<threads, non_exited_threads, threads_safe>: New methods.
(ALL_INFERIORS): Delete.
Include "inferior-iter.h".
(ALL_NON_EXITED_INFERIORS): Delete.
(all_inferiors_safe, all_inferiors, all_non_exited_inferiors): New
functions.
* inflow.c (child_interrupt, child_pass_ctrlc): Replace
ALL_NON_EXITED_THREADS with all_non_exited_threads.
* infrun.c (follow_exec): Use all_threads_safe.
(clear_proceed_status, proceed): Use all_non_exited_threads.
(init_wait_for_inferior): Don't clear inline frame state here.
(infrun_thread_stop_requested, for_each_just_stopped_thread): Use
all_threads instead of ALL_NON_EXITED_THREADS.
(random_pending_event_thread): Use all_non_exited_threads instead
of ALL_NON_EXITED_THREADS. Use a lambda for repeated code.
(clean_up_just_stopped_threads_fsms): Use all_non_exited_threads
instead of ALL_NON_EXITED_THREADS.
(handle_no_resumed): Use all_non_exited_threads instead of
ALL_NON_EXITED_THREADS. Use all_inferiors instead of
ALL_INFERIORS.
(restart_threads, switch_back_to_stepped_thread): Use
all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
* linux-nat.c (check_zombie_leaders): Replace ALL_INFERIORS with
all_inferiors.
(kill_unfollowed_fork_children): Use inf->non_exited_threads
instead of ALL_NON_EXITED_THREADS.
* linux-tdep.c (linux_make_corefile_notes): Use
inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
* linux-thread-db.c (thread_db_target::update_thread_list):
Replace ALL_INFERIORS with all_inferiors.
(thread_db_target::thread_handle_to_thread_info): Use
inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
* mi/mi-interp.c (multiple_inferiors_p): New.
(mi_on_resume_1): Simplify using all_non_exited_threads and
multiple_inferiors_p.
* mi/mi-main.c (mi_cmd_thread_list_ids): Use all_non_exited_threads
instead of ALL_NON_EXITED_THREADS.
* nto-procfs.c (nto_procfs_target::open): Don't call
init_thread_list here.
* record-btrace.c (record_btrace_target_open)
(record_btrace_target::stop_recording)
(record_btrace_target::close)
(record_btrace_target::record_is_replaying)
(record_btrace_target::resume, record_btrace_target::wait)
(record_btrace_target::record_stop_replaying): Use
all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
* record-full.c (record_full_wait_1): Use all_non_exited_threads
instead of ALL_NON_EXITED_THREADS.
* regcache.c (cooked_read_test): Remove reference to global
thread_list.
* remote-sim.c (gdbsim_target::create_inferior): Don't call
init_thread_list here.
* remote.c (remote_target::update_thread_list): Use
all_threads_safe instead of ALL_NON_EXITED_THREADS.
(remote_target::process_initial_stop_replies): Replace
ALL_INFERIORS with all_non_exited_inferiors and use
all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
(remote_target::open_1): Don't call init_thread_list here.
(remote_target::append_pending_thread_resumptions)
(remote_target::remote_resume_with_hc): Use all_non_exited_threads
instead of ALL_NON_EXITED_THREADS.
(remote_target::commit_resume)
(remote_target::remove_new_fork_children): Replace ALL_INFERIORS
with all_non_exited_inferiors and use all_non_exited_threads
instead of ALL_NON_EXITED_THREADS.
(remote_target::kill_new_fork_children): Use
all_non_exited_threads instead of ALL_NON_EXITED_THREADS. Remove
init_thread_list and init_wait_for_inferior calls.
(remote_target::remote_btrace_maybe_reopen)
(remote_target::thread_handle_to_thread_info): Use
all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
* target.c (target_terminal::restore_inferior)
(target_terminal_is_ours_kind): Replace ALL_INFERIORS with
all_non_exited_inferiors.
* thread-iter.c: New file.
* thread-iter.h: New file.
* thread.c: Include "inline-frame.h".
(thread_list): Delete.
(clear_thread_inferior_resources): Call clear_inline_frame_state.
(init_thread_list): Use all_threads_safe instead of
ALL_THREADS_SAFE. Adjust to per-inferior thread lists.
(new_thread): Adjust to per-inferior thread lists.
(add_thread_silent): Pass inferior to find_thread_ptid.
(thread_info::deletable): New, moved from the header.
(delete_thread_1): Adjust to per-inferior thread lists.
(find_thread_global_id): Use inf->threads().
(find_thread_ptid): Use find_inferior_ptid and pass inferior to
find_thread_ptid.
(find_thread_ptid(inferior*, ptid_t)): New overload.
(iterate_over_threads): Use all_threads_safe.
(any_thread_p): New.
(thread_count): Use all_threads and std::distance.
(live_threads_count): Use all_non_exited_threads and
std::distance.
(valid_global_thread_id): Use all_threads.
(in_thread_list): Use find_thread_ptid.
(first_thread_of_inferior): Adjust to per-inferior thread lists.
(any_thread_of_inferior, any_live_thread_of_inferior): Use
inf->non_exited_threads().
(prune_threads, delete_exited_threads): Use all_threads_safe.
(thread_change_ptid): Pass inferior pointer to find_thread_ptid.
(set_resumed, set_running): Use all_non_exited_threads.
(is_thread_state, is_stopped, is_exited, is_running)
(is_executing): Delete.
(set_executing, set_stop_requested, finish_thread_state): Use
all_non_exited_threads.
(print_thread_info_1): Use all_inferiors and all_threads.
(thread_apply_all_command): Use all_non_exited_threads.
(thread_find_command): Use all_threads.
(update_threads_executing): Use all_non_exited_threads.
* tid-parse.c (parse_thread_id): Use inf->threads.
* x86-bsd-nat.c (x86bsd_dr_set): Use inf->non_exited_threads ().
2018-11-22 17:09:14 +01:00
|
|
|
for (thread_info *tp : all_non_exited_threads ())
|
2014-10-15 21:18:32 +02:00
|
|
|
delete_single_step_breakpoints (tp);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_resume_step)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Is this a SIGTRAP? */
|
|
|
|
if (status->kind == TARGET_WAITKIND_STOPPED
|
|
|
|
&& status->value.sig == GDB_SIGNAL_TRAP)
|
|
|
|
{
|
|
|
|
struct regcache *regcache;
|
2015-03-04 21:41:15 +01:00
|
|
|
enum target_stop_reason *stop_reason_p
|
|
|
|
= &record_full_stop_reason;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Yes -- this is likely our single-step finishing,
|
|
|
|
but check if there's any reason the core would be
|
|
|
|
interested in the event. */
|
|
|
|
|
|
|
|
registers_changed ();
|
Multi-target support
This commit adds multi-target support to GDB. What this means is that
with this commit, GDB can now be connected to different targets at the
same time. E.g., you can debug a live native process and a core dump
at the same time, connect to multiple gdbservers, etc.
Actually, the word "target" is overloaded in gdb. We already have a
target stack, with pushes several target_ops instances on top of one
another. We also have "info target" already, which means something
completely different to what this patch does.
So from here on, I'll be using the "target connections" term, to mean
an open process_stratum target, pushed on a target stack. This patch
makes gdb have multiple target stacks, and multiple process_stratum
targets open simultaneously. The user-visible changes / commands will
also use this terminology, but of course it's all open to debate.
User-interface-wise, not that much changes. The main difference is
that each inferior may have its own target connection.
A target connection (e.g., a target extended-remote connection) may
support debugging multiple processes, just as before.
Say you're debugging against gdbserver in extended-remote mode, and
you do "add-inferior" to prepare to spawn a new process, like:
(gdb) target extended-remote :9999
...
(gdb) start
...
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) file a.out
...
(gdb) start
...
At this point, you have two inferiors connected to the same gdbserver.
With this commit, GDB will maintain a target stack per inferior,
instead of a global target stack.
To preserve the behavior above, by default, "add-inferior" makes the
new inferior inherit a copy of the target stack of the current
inferior. Same across a fork - the child inherits a copy of the
target stack of the parent. While the target stacks are copied, the
targets themselves are not. Instead, target_ops is made a
refcounted_object, which means that target_ops instances are
refcounted, which each inferior counting for a reference.
What if you want to create an inferior and connect it to some _other_
target? For that, this commit introduces a new "add-inferior
-no-connection" option that makes the new inferior not share the
current inferior's target. So you could do:
(gdb) target extended-remote :9999
Remote debugging using :9999
...
(gdb) add-inferior -no-connection
[New inferior 2]
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 <null>
(gdb) tar extended-remote :10000
Remote debugging using :10000
...
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 process 18450 target:/home/pedro/tmp/main
(gdb)
A following patch will extended "info inferiors" to include a column
indicating which connection an inferior is bound to, along with a
couple other UI tweaks.
Other than that, debugging is the same as before. Users interact with
inferiors and threads as before. The only difference is that
inferiors may be bound to processes running in different machines.
That's pretty much all there is to it in terms of noticeable UI
changes.
On to implementation.
Since we can be connected to different systems at the same time, a
ptid_t is no longer a unique identifier. Instead a thread can be
identified by a pair of ptid_t and 'process_stratum_target *', the
later being the instance of the process_stratum target that owns the
process/thread. Note that process_stratum_target inherits from
target_ops, and all process_stratum targets inherit from
process_stratum_target. In earlier patches, many places in gdb were
converted to refer to threads by thread_info pointer instead of
ptid_t, but there are still places in gdb where we start with a
pid/tid and need to find the corresponding inferior or thread_info
objects. So you'll see in the patch many places adding a
process_stratum_target parameter to functions that used to take only a
ptid_t.
Since each inferior has its own target stack now, we can always find
the process_stratum target for an inferior. That is done via a
inf->process_target() convenience method.
Since each inferior has its own target stack, we need to handle the
"beneath" calls when servicing target calls. The solution I settled
with is just to make sure to switch the current inferior to the
inferior you want before making a target call. Not relying on global
context is just not feasible in current GDB. Fortunately, there
aren't that many places that need to do that, because generally most
code that calls target methods already has the current context
pointing to the right inferior/thread. Note, to emphasize -- there's
no method to "switch to this target stack". Instead, you switch the
current inferior, and that implicitly switches the target stack.
In some spots, we need to iterate over all inferiors so that we reach
all target stacks.
Native targets are still singletons. There's always only a single
instance of such targets.
Remote targets however, we'll have one instance per remote connection.
The exec target is still a singleton. There's only one instance. I
did not see the point of instanciating more than one exec_target
object.
After vfork, we need to make sure to push the exec target on the new
inferior. See exec_on_vfork.
For type safety, functions that need a {target, ptid} pair to identify
a thread, take a process_stratum_target pointer for target parameter
instead of target_ops *. Some shared code in gdb/nat/ also need to
gain a target pointer parameter. This poses an issue, since gdbserver
doesn't have process_stratum_target, only target_ops. To fix this,
this commit renames gdbserver's target_ops to process_stratum_target.
I think this makes sense. There's no concept of target stack in
gdbserver, and gdbserver's target_ops really implements a
process_stratum-like target.
The thread and inferior iterator functions also gain
process_stratum_target parameters. These are used to be able to
iterate over threads and inferiors of a given target. Following usual
conventions, if the target pointer is null, then we iterate over
threads and inferiors of all targets.
I tried converting "add-inferior" to the gdb::option framework, as a
preparatory patch, but that stumbled on the fact that gdb::option does
not support file options yet, for "add-inferior -exec". I have a WIP
patchset that adds that, but it's not a trivial patch, mainly due to
need to integrate readline's filename completion, so I deferred that
to some other time.
In infrun.c/infcmd.c, the main change is that we need to poll events
out of all targets. See do_target_wait. Right after collecting an
event, we switch the current inferior to an inferior bound to the
target that reported the event, so that target methods can be used
while handling the event. This makes most of the code transparent to
multi-targets. See fetch_inferior_event.
infrun.c:stop_all_threads is interesting -- in this function we need
to stop all threads of all targets. What the function does is send an
asynchronous stop request to all threads, and then synchronously waits
for events, with target_wait, rinse repeat, until all it finds are
stopped threads. Now that we have multiple targets, it's not
efficient to synchronously block in target_wait waiting for events out
of one target. Instead, we implement a mini event loop, with
interruptible_select, select'ing on one file descriptor per target.
For this to work, we need to be able to ask the target for a waitable
file descriptor. Such file descriptors already exist, they are the
descriptors registered in the main event loop with add_file_handler,
inside the target_async implementations. This commit adds a new
target_async_wait_fd target method that just returns the file
descriptor in question. See wait_one / stop_all_threads in infrun.c.
The 'threads_executing' global is made a per-target variable. Since
it is only relevant to process_stratum_target targets, this is where
it is put, instead of in target_ops.
You'll notice that remote.c includes some FIXME notes. These refer to
the fact that the global arrays that hold data for the remote packets
supported are still globals. For example, if we connect to two
different servers/stubs, then each might support different remote
protocol features. They might even be different architectures, like
e.g., one ARM baremetal stub, and a x86 gdbserver, to debug a
host/controller scenario as a single program. That isn't going to
work correctly today, because of said globals. I'm leaving fixing
that for another pass, since it does not appear to be trivial, and I'd
rather land the base work first. It's already useful to be able to
debug multiple instances of the same server (e.g., a distributed
cluster, where you have full control over the servers installed), so I
think as is it's already reasonable incremental progress.
Current limitations:
- You can only resume more that one target at the same time if all
targets support asynchronous debugging, and support non-stop mode.
It should be possible to support mixed all-stop + non-stop
backends, but that is left for another time. This means that
currently in order to do multi-target with gdbserver you need to
issue "maint set target-non-stop on". I would like to make that
mode be the default, but we're not there yet. Note that I'm
talking about how the target backend works, only. User-visible
all-stop mode works just fine.
- As explained above, connecting to different remote servers at the
same time is likely to produce bad results if they don't support the
exact set of RSP features.
FreeBSD updates courtesy of John Baldwin.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@FreeBSD.org>
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Adjust.
* ada-tasks.c (print_ada_task_info): Adjust find_thread_ptid call.
(task_command_1): Likewise.
* aix-thread.c (sync_threadlists, aix_thread_target::resume)
(aix_thread_target::wait, aix_thread_target::fetch_registers)
(aix_thread_target::store_registers)
(aix_thread_target::thread_alive): Adjust.
* amd64-fbsd-tdep.c: Include "inferior.h".
(amd64fbsd_get_thread_local_address): Pass down target.
* amd64-linux-nat.c (ps_get_thread_area): Use ps_prochandle
thread's gdbarch instead of target_gdbarch.
* break-catch-sig.c (signal_catchpoint_print_it): Adjust call to
get_last_target_status.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
* breakpoint.c (breakpoints_should_be_inserted_now): Consider all
inferiors.
(update_inserted_breakpoint_locations): Skip if inferiors with no
execution.
(update_global_location_list): When handling moribund locations,
find representative inferior for location's pspace, and use thread
count of its process_stratum target.
* bsd-kvm.c (bsd_kvm_target_open): Pass target down.
* bsd-uthread.c (bsd_uthread_target::wait): Use
as_process_stratum_target and adjust thread_change_ptid and
add_thread calls.
(bsd_uthread_target::update_thread_list): Use
as_process_stratum_target and adjust find_thread_ptid,
thread_change_ptid and add_thread calls.
* btrace.c (maint_btrace_packet_history_cmd): Adjust
find_thread_ptid call.
* corelow.c (add_to_thread_list): Adjust add_thread call.
(core_target_open): Adjust add_thread_silent and thread_count
calls.
(core_target::pid_to_str): Adjust find_inferior_ptid call.
* ctf.c (ctf_target_open): Adjust add_thread_silent call.
* event-top.c (async_disconnect): Pop targets from all inferiors.
* exec.c (add_target_sections): Push exec target on all inferiors
sharing the program space.
(remove_target_sections): Remove the exec target from all
inferiors sharing the program space.
(exec_on_vfork): New.
* exec.h (exec_on_vfork): Declare.
* fbsd-nat.c (fbsd_add_threads): Add fbsd_nat_target parameter.
Pass it down.
(fbsd_nat_target::update_thread_list): Adjust.
(fbsd_nat_target::resume): Adjust.
(fbsd_handle_debug_trap): Add fbsd_nat_target parameter. Pass it
down.
(fbsd_nat_target::wait, fbsd_nat_target::post_attach): Adjust.
* fbsd-tdep.c (fbsd_corefile_thread): Adjust
get_thread_arch_regcache call.
* fork-child.c (gdb_startup_inferior): Pass target down to
startup_inferior and set_executing.
* gdbthread.h (struct process_stratum_target): Forward declare.
(add_thread, add_thread_silent, add_thread_with_info)
(in_thread_list): Add process_stratum_target parameter.
(find_thread_ptid(inferior*, ptid_t)): New overload.
(find_thread_ptid, thread_change_ptid): Add process_stratum_target
parameter.
(all_threads()): Delete overload.
(all_threads, all_non_exited_threads): Add process_stratum_target
parameter.
(all_threads_safe): Use brace initialization.
(thread_count): Add process_stratum_target parameter.
(set_resumed, set_running, set_stop_requested, set_executing)
(threads_are_executing, finish_thread_state): Add
process_stratum_target parameter.
(switch_to_thread): Use is_current_thread.
* i386-fbsd-tdep.c: Include "inferior.h".
(i386fbsd_get_thread_local_address): Pass down target.
* i386-linux-nat.c (i386_linux_nat_target::low_resume): Adjust.
* inf-child.c (inf_child_target::maybe_unpush_target): Remove
have_inferiors check.
* inf-ptrace.c (inf_ptrace_target::create_inferior)
(inf_ptrace_target::attach): Adjust.
* infcall.c (run_inferior_call): Adjust.
* infcmd.c (run_command_1): Pass target to
scoped_finish_thread_state.
(proceed_thread_callback): Skip inferiors with no execution.
(continue_command): Rename 'all_threads' local to avoid hiding
'all_threads' function. Adjust get_last_target_status call.
(prepare_one_step): Adjust set_running call.
(signal_command): Use user_visible_resume_target. Compare thread
pointers instead of inferior_ptid.
(info_program_command): Adjust to pass down target.
(attach_command): Mark target's 'thread_executing' flag.
(stop_current_target_threads_ns): New, factored out from ...
(interrupt_target_1): ... this. Switch inferior before making
target calls.
* inferior-iter.h
(struct all_inferiors_iterator, struct all_inferiors_range)
(struct all_inferiors_safe_range)
(struct all_non_exited_inferiors_range): Filter on
process_stratum_target too. Remove explicit.
* inferior.c (inferior::inferior): Push dummy target on target
stack.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors):
Add process_stratum_target parameter, and pass it down.
(have_live_inferiors): Adjust.
(switch_to_inferior_and_push_target): New.
(add_inferior_command, clone_inferior_command): Handle
"-no-connection" parameter. Use
switch_to_inferior_and_push_target.
(_initialize_inferior): Mention "-no-connection" option in
the help of "add-inferior" and "clone-inferior" commands.
* inferior.h: Include "process-stratum-target.h".
(interrupt_target_1): Use bool.
(struct inferior) <push_target, unpush_target, target_is_pushed,
find_target_beneath, top_target, process_target, target_at,
m_stack>: New.
(discard_all_inferiors): Delete.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors)
(all_inferiors, all_non_exited_inferiors): Add
process_stratum_target parameter.
* infrun.c: Include "gdb_select.h" and <unordered_map>.
(target_last_proc_target): New global.
(follow_fork_inferior): Push target on new inferior. Pass target
to add_thread_silent. Call exec_on_vfork. Handle target's
reference count.
(follow_fork): Adjust get_last_target_status call. Also consider
target.
(follow_exec): Push target on new inferior.
(struct execution_control_state) <target>: New field.
(user_visible_resume_target): New.
(do_target_resume): Call target_async.
(resume_1): Set target's threads_executing flag. Consider resume
target.
(commit_resume_all_targets): New.
(proceed): Also consider resume target. Skip threads of inferiors
with no execution. Commit resumtion in all targets.
(start_remote): Pass current inferior to wait_for_inferior.
(infrun_thread_stop_requested): Consider target as well. Pass
thread_info pointer to clear_inline_frame_state instead of ptid.
(infrun_thread_thread_exit): Consider target as well.
(random_pending_event_thread): New inferior parameter. Use it.
(do_target_wait): Rename to ...
(do_target_wait_1): ... this. Add inferior parameter, and pass it
down.
(threads_are_resumed_pending_p, do_target_wait): New.
(prepare_for_detach): Adjust calls.
(wait_for_inferior): New inferior parameter. Handle it. Use
do_target_wait_1 instead of do_target_wait.
(fetch_inferior_event): Adjust. Switch to representative
inferior. Pass target down.
(set_last_target_status): Add process_stratum_target parameter.
Save target in global.
(get_last_target_status): Add process_stratum_target parameter and
handle it.
(nullify_last_target_wait_ptid): Clear 'target_last_proc_target'.
(context_switch): Check inferior_ptid == null_ptid before calling
inferior_thread().
(get_inferior_stop_soon): Pass down target.
(wait_one): Rename to ...
(poll_one_curr_target): ... this.
(struct wait_one_event): New.
(wait_one): New.
(stop_all_threads): Adjust.
(handle_no_resumed, handle_inferior_event): Adjust to consider the
event's target.
(switch_back_to_stepped_thread): Also consider target.
(print_stop_event): Update.
(normal_stop): Update. Also consider the resume target.
* infrun.h (wait_for_inferior): Remove declaration.
(user_visible_resume_target): New declaration.
(get_last_target_status, set_last_target_status): New
process_stratum_target parameter.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter, and use it.
(clear_inline_frame_state (thread_info*)): New.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter.
(clear_inline_frame_state (thread_info*)): Declare.
* linux-fork.c (delete_checkpoint_command): Pass target down to
find_thread_ptid.
(checkpoint_command): Adjust.
* linux-nat.c (linux_nat_target::follow_fork): Switch to thread
instead of just tweaking inferior_ptid.
(linux_nat_switch_fork): Pass target down to thread_change_ptid.
(exit_lwp): Pass target down to find_thread_ptid.
(attach_proc_task_lwp_callback): Pass target down to
add_thread/set_running/set_executing.
(linux_nat_target::attach): Pass target down to
thread_change_ptid.
(get_detach_signal): Pass target down to find_thread_ptid.
Consider last target status's target.
(linux_resume_one_lwp_throw, resume_lwp)
(linux_handle_syscall_trap, linux_handle_extended_wait, wait_lwp)
(stop_wait_callback, save_stop_reason, linux_nat_filter_event)
(linux_nat_wait_1, resume_stopped_resumed_lwps): Pass target down.
(linux_nat_target::async_wait_fd): New.
(linux_nat_stop_lwp, linux_nat_target::thread_address_space): Pass
target down.
* linux-nat.h (linux_nat_target::async_wait_fd): Declare.
* linux-tdep.c (get_thread_arch_regcache): Pass target down.
* linux-thread-db.c (struct thread_db_info::process_target): New
field.
(add_thread_db_info): Save target.
(get_thread_db_info): New process_stratum_target parameter. Also
match target.
(delete_thread_db_info): New process_stratum_target parameter.
Also match target.
(thread_from_lwp): Adjust to pass down target.
(thread_db_notice_clone): Pass down target.
(check_thread_db_callback): Pass down target.
(try_thread_db_load_1): Always push the thread_db target.
(try_thread_db_load, record_thread): Pass target down.
(thread_db_target::detach): Pass target down. Always unpush the
thread_db target.
(thread_db_target::wait, thread_db_target::mourn_inferior): Pass
target down. Always unpush the thread_db target.
(find_new_threads_callback, thread_db_find_new_threads_2)
(thread_db_target::update_thread_list): Pass target down.
(thread_db_target::pid_to_str): Pass current inferior down.
(thread_db_target::get_thread_local_address): Pass target down.
(thread_db_target::resume, maintenance_check_libthread_db): Pass
target down.
* nto-procfs.c (nto_procfs_target::update_thread_list): Adjust.
* procfs.c (procfs_target::procfs_init_inferior): Declare.
(proc_set_current_signal, do_attach, procfs_target::wait): Adjust.
(procfs_init_inferior): Rename to ...
(procfs_target::procfs_init_inferior): ... this and adjust.
(procfs_target::create_inferior, procfs_notice_thread)
(procfs_do_thread_registers): Adjust.
* ppc-fbsd-tdep.c: Include "inferior.h".
(ppcfbsd_get_thread_local_address): Pass down target.
* proc-service.c (ps_xfer_memory): Switch current inferior and
program space as well.
(get_ps_regcache): Pass target down.
* process-stratum-target.c
(process_stratum_target::thread_address_space)
(process_stratum_target::thread_architecture): Pass target down.
* process-stratum-target.h
(process_stratum_target::threads_executing): New field.
(as_process_stratum_target): New.
* ravenscar-thread.c
(ravenscar_thread_target::update_inferior_ptid): Pass target down.
(ravenscar_thread_target::wait, ravenscar_add_thread): Pass target
down.
* record-btrace.c (record_btrace_target::info_record): Adjust.
(record_btrace_target::record_method)
(record_btrace_target::record_is_replaying)
(record_btrace_target::fetch_registers)
(get_thread_current_frame_id, record_btrace_target::resume)
(record_btrace_target::wait, record_btrace_target::stop): Pass
target down.
* record-full.c (record_full_wait_1): Switch to event thread.
Pass target down.
* regcache.c (regcache::regcache)
(get_thread_arch_aspace_regcache, get_thread_arch_regcache): Add
process_stratum_target parameter and handle it.
(current_thread_target): New global.
(get_thread_regcache): Add process_stratum_target parameter and
handle it. Switch inferior before calling target method.
(get_thread_regcache): Pass target down.
(get_thread_regcache_for_ptid): Pass target down.
(registers_changed_ptid): Add process_stratum_target parameter and
handle it.
(registers_changed_thread, registers_changed): Pass target down.
(test_get_thread_arch_aspace_regcache): New.
(current_regcache_test): Define a couple local test_target_ops
instances and use them for testing.
(readwrite_regcache): Pass process_stratum_target parameter.
(cooked_read_test, cooked_write_test): Pass mock_target down.
* regcache.h (get_thread_regcache, get_thread_arch_regcache)
(get_thread_arch_aspace_regcache): Add process_stratum_target
parameter.
(regcache::target): New method.
(regcache::regcache, regcache::get_thread_arch_aspace_regcache)
(regcache::registers_changed_ptid): Add process_stratum_target
parameter.
(regcache::m_target): New field.
(registers_changed_ptid): Add process_stratum_target parameter.
* remote.c (remote_state::supports_vCont_probed): New field.
(remote_target::async_wait_fd): New method.
(remote_unpush_and_throw): Add remote_target parameter.
(get_current_remote_target): Adjust.
(remote_target::remote_add_inferior): Push target.
(remote_target::remote_add_thread)
(remote_target::remote_notice_new_inferior)
(get_remote_thread_info): Pass target down.
(remote_target::update_thread_list): Skip threads of inferiors
bound to other targets. (remote_target::close): Don't discard
inferiors. (remote_target::add_current_inferior_and_thread)
(remote_target::process_initial_stop_replies)
(remote_target::start_remote)
(remote_target::remote_serial_quit_handler): Pass down target.
(remote_target::remote_unpush_target): New remote_target
parameter. Unpush the target from all inferiors.
(remote_target::remote_unpush_and_throw): New remote_target
parameter. Pass it down.
(remote_target::open_1): Check whether the current inferior has
execution instead of checking whether any inferior is live. Pass
target down.
(remote_target::remote_detach_1): Pass down target. Use
remote_unpush_target.
(extended_remote_target::attach): Pass down target.
(remote_target::remote_vcont_probe): Set supports_vCont_probed.
(remote_target::append_resumption): Pass down target.
(remote_target::append_pending_thread_resumptions)
(remote_target::remote_resume_with_hc, remote_target::resume)
(remote_target::commit_resume): Pass down target.
(remote_target::remote_stop_ns): Check supports_vCont_probed.
(remote_target::interrupt_query)
(remote_target::remove_new_fork_children)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::remote_parse_stop_reply)
(remote_target::process_stop_reply): Pass down target.
(first_remote_resumed_thread): New remote_target parameter. Pass
it down.
(remote_target::wait_as): Pass down target.
(unpush_and_perror): New remote_target parameter. Pass it down.
(remote_target::readchar, remote_target::remote_serial_write)
(remote_target::getpkt_or_notif_sane_1)
(remote_target::kill_new_fork_children, remote_target::kill): Pass
down target.
(remote_target::mourn_inferior): Pass down target. Use
remote_unpush_target.
(remote_target::core_of_thread)
(remote_target::remote_btrace_maybe_reopen): Pass down target.
(remote_target::pid_to_exec_file)
(remote_target::thread_handle_to_thread_info): Pass down target.
(remote_target::async_wait_fd): New.
* riscv-fbsd-tdep.c: Include "inferior.h".
(riscv_fbsd_get_thread_local_address): Pass down target.
* sol2-tdep.c (sol2_core_pid_to_str): Pass down target.
* sol-thread.c (sol_thread_target::wait, ps_lgetregs, ps_lsetregs)
(ps_lgetfpregs, ps_lsetfpregs, sol_update_thread_list_callback):
Adjust.
* solib-spu.c (spu_skip_standalone_loader): Pass down target.
* solib-svr4.c (enable_break): Pass down target.
* spu-multiarch.c (parse_spufs_run): Pass down target.
* spu-tdep.c (spu2ppu_sniffer): Pass down target.
* target-delegates.c: Regenerate.
* target.c (g_target_stack): Delete.
(current_top_target): Return the current inferior's top target.
(target_has_execution_1): Refer to the passed-in inferior's top
target.
(target_supports_terminal_ours): Check whether the initial
inferior was already created.
(decref_target): New.
(target_stack::push): Incref/decref the target.
(push_target, push_target, unpush_target): Adjust.
(target_stack::unpush): Defref target.
(target_is_pushed): Return bool. Adjust to refer to the current
inferior's target stack.
(dispose_inferior): Delete, and inline parts ...
(target_preopen): ... here. Only dispose of the current inferior.
(target_detach): Hold strong target reference while detaching.
Pass target down.
(target_thread_name): Add assertion.
(target_resume): Pass down target.
(target_ops::beneath, find_target_at): Adjust to refer to the
current inferior's target stack.
(get_dummy_target): New.
(target_pass_ctrlc): Pass the Ctrl-C to the first inferior that
has a thread running.
(initialize_targets): Rename to ...
(_initialize_target): ... this.
* target.h: Include "gdbsupport/refcounted-object.h".
(struct target_ops): Inherit refcounted_object.
(target_ops::shortname, target_ops::longname): Make const.
(target_ops::async_wait_fd): New method.
(decref_target): Declare.
(struct target_ops_ref_policy): New.
(target_ops_ref): New typedef.
(get_dummy_target): Declare function.
(target_is_pushed): Return bool.
* thread-iter.c (all_matching_threads_iterator::m_inf_matches)
(all_matching_threads_iterator::all_matching_threads_iterator):
Handle filter target.
* thread-iter.h (struct all_matching_threads_iterator, struct
all_matching_threads_range, class all_non_exited_threads_range):
Filter by target too. Remove explicit.
* thread.c (threads_executing): Delete.
(inferior_thread): Pass down current inferior.
(clear_thread_inferior_resources): Pass down thread pointer
instead of ptid_t.
(add_thread_silent, add_thread_with_info, add_thread): Add
process_stratum_target parameter. Use it for thread and inferior
searches.
(is_current_thread): New.
(thread_info::deletable): Use it.
(find_thread_ptid, thread_count, in_thread_list)
(thread_change_ptid, set_resumed, set_running): New
process_stratum_target parameter. Pass it down.
(set_executing): New process_stratum_target parameter. Pass it
down. Adjust reference to 'threads_executing'.
(threads_are_executing): New process_stratum_target parameter.
Adjust reference to 'threads_executing'.
(set_stop_requested, finish_thread_state): New
process_stratum_target parameter. Pass it down.
(switch_to_thread): Also match inferior.
(switch_to_thread): New process_stratum_target parameter. Pass it
down.
(update_threads_executing): Reimplement.
* top.c (quit_force): Pop targets from all inferior.
(gdb_init): Don't call initialize_targets.
* windows-nat.c (windows_nat_target) <get_windows_debug_event>:
Declare.
(windows_add_thread, windows_delete_thread): Adjust.
(get_windows_debug_event): Rename to ...
(windows_nat_target::get_windows_debug_event): ... this. Adjust.
* tracefile-tfile.c (tfile_target_open): Pass down target.
* gdbsupport/common-gdbthread.h (struct process_stratum_target):
Forward declare.
(switch_to_thread): Add process_stratum_target parameter.
* mi/mi-interp.c (mi_on_resume_1): Add process_stratum_target
parameter. Use it.
(mi_on_resume): Pass target down.
* nat/fork-inferior.c (startup_inferior): Add
process_stratum_target parameter. Pass it down.
* nat/fork-inferior.h (startup_inferior): Add
process_stratum_target parameter.
* python/py-threadevent.c (py_get_event_thread): Pass target down.
gdb/gdbserver/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* fork-child.c (post_fork_inferior): Pass target down to
startup_inferior.
* inferiors.c (switch_to_thread): Add process_stratum_target
parameter.
* lynx-low.c (lynx_target_ops): Now a process_stratum_target.
* nto-low.c (nto_target_ops): Now a process_stratum_target.
* linux-low.c (linux_target_ops): Now a process_stratum_target.
* remote-utils.c (prepare_resume_reply): Pass the target to
switch_to_thread.
* target.c (the_target): Now a process_stratum_target.
(done_accessing_memory): Pass the target to switch_to_thread.
(set_target_ops): Ajust to use process_stratum_target.
* target.h (struct target_ops): Rename to ...
(struct process_stratum_target): ... this.
(the_target, set_target_ops): Adjust.
(prepare_to_access_memory): Adjust comment.
* win32-low.c (child_xfer_memory): Adjust to use
process_stratum_target.
(win32_target_ops): Now a process_stratum_target.
2020-01-10 21:06:08 +01:00
|
|
|
switch_to_thread (current_inferior ()->process_target (),
|
|
|
|
ret);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
regcache = get_current_regcache ();
|
|
|
|
tmp_pc = regcache_read_pc (regcache);
|
2017-11-02 16:15:42 +01:00
|
|
|
const struct address_space *aspace = regcache->aspace ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (target_stopped_by_watchpoint ())
|
|
|
|
{
|
|
|
|
/* Always interested in watchpoints. */
|
|
|
|
}
|
2015-03-04 21:41:15 +01:00
|
|
|
else if (record_check_stopped_by_breakpoint (aspace, tmp_pc,
|
|
|
|
stop_reason_p))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* There is a breakpoint here. Let the core
|
|
|
|
handle it. */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* This is a single-step trap. Record the
|
|
|
|
insn and issue another step.
|
|
|
|
FIXME: this part can be a random SIGTRAP too.
|
|
|
|
But GDB cannot handle it. */
|
|
|
|
int step = 1;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!record_full_message_wrapper_safe (regcache,
|
|
|
|
GDB_SIGNAL_0))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
status->kind = TARGET_WAITKIND_STOPPED;
|
|
|
|
status->value.sig = GDB_SIGNAL_0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gdbarch_software_single_step_p (gdbarch))
|
|
|
|
{
|
Multi-target support
This commit adds multi-target support to GDB. What this means is that
with this commit, GDB can now be connected to different targets at the
same time. E.g., you can debug a live native process and a core dump
at the same time, connect to multiple gdbservers, etc.
Actually, the word "target" is overloaded in gdb. We already have a
target stack, with pushes several target_ops instances on top of one
another. We also have "info target" already, which means something
completely different to what this patch does.
So from here on, I'll be using the "target connections" term, to mean
an open process_stratum target, pushed on a target stack. This patch
makes gdb have multiple target stacks, and multiple process_stratum
targets open simultaneously. The user-visible changes / commands will
also use this terminology, but of course it's all open to debate.
User-interface-wise, not that much changes. The main difference is
that each inferior may have its own target connection.
A target connection (e.g., a target extended-remote connection) may
support debugging multiple processes, just as before.
Say you're debugging against gdbserver in extended-remote mode, and
you do "add-inferior" to prepare to spawn a new process, like:
(gdb) target extended-remote :9999
...
(gdb) start
...
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) file a.out
...
(gdb) start
...
At this point, you have two inferiors connected to the same gdbserver.
With this commit, GDB will maintain a target stack per inferior,
instead of a global target stack.
To preserve the behavior above, by default, "add-inferior" makes the
new inferior inherit a copy of the target stack of the current
inferior. Same across a fork - the child inherits a copy of the
target stack of the parent. While the target stacks are copied, the
targets themselves are not. Instead, target_ops is made a
refcounted_object, which means that target_ops instances are
refcounted, which each inferior counting for a reference.
What if you want to create an inferior and connect it to some _other_
target? For that, this commit introduces a new "add-inferior
-no-connection" option that makes the new inferior not share the
current inferior's target. So you could do:
(gdb) target extended-remote :9999
Remote debugging using :9999
...
(gdb) add-inferior -no-connection
[New inferior 2]
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 <null>
(gdb) tar extended-remote :10000
Remote debugging using :10000
...
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 process 18450 target:/home/pedro/tmp/main
(gdb)
A following patch will extended "info inferiors" to include a column
indicating which connection an inferior is bound to, along with a
couple other UI tweaks.
Other than that, debugging is the same as before. Users interact with
inferiors and threads as before. The only difference is that
inferiors may be bound to processes running in different machines.
That's pretty much all there is to it in terms of noticeable UI
changes.
On to implementation.
Since we can be connected to different systems at the same time, a
ptid_t is no longer a unique identifier. Instead a thread can be
identified by a pair of ptid_t and 'process_stratum_target *', the
later being the instance of the process_stratum target that owns the
process/thread. Note that process_stratum_target inherits from
target_ops, and all process_stratum targets inherit from
process_stratum_target. In earlier patches, many places in gdb were
converted to refer to threads by thread_info pointer instead of
ptid_t, but there are still places in gdb where we start with a
pid/tid and need to find the corresponding inferior or thread_info
objects. So you'll see in the patch many places adding a
process_stratum_target parameter to functions that used to take only a
ptid_t.
Since each inferior has its own target stack now, we can always find
the process_stratum target for an inferior. That is done via a
inf->process_target() convenience method.
Since each inferior has its own target stack, we need to handle the
"beneath" calls when servicing target calls. The solution I settled
with is just to make sure to switch the current inferior to the
inferior you want before making a target call. Not relying on global
context is just not feasible in current GDB. Fortunately, there
aren't that many places that need to do that, because generally most
code that calls target methods already has the current context
pointing to the right inferior/thread. Note, to emphasize -- there's
no method to "switch to this target stack". Instead, you switch the
current inferior, and that implicitly switches the target stack.
In some spots, we need to iterate over all inferiors so that we reach
all target stacks.
Native targets are still singletons. There's always only a single
instance of such targets.
Remote targets however, we'll have one instance per remote connection.
The exec target is still a singleton. There's only one instance. I
did not see the point of instanciating more than one exec_target
object.
After vfork, we need to make sure to push the exec target on the new
inferior. See exec_on_vfork.
For type safety, functions that need a {target, ptid} pair to identify
a thread, take a process_stratum_target pointer for target parameter
instead of target_ops *. Some shared code in gdb/nat/ also need to
gain a target pointer parameter. This poses an issue, since gdbserver
doesn't have process_stratum_target, only target_ops. To fix this,
this commit renames gdbserver's target_ops to process_stratum_target.
I think this makes sense. There's no concept of target stack in
gdbserver, and gdbserver's target_ops really implements a
process_stratum-like target.
The thread and inferior iterator functions also gain
process_stratum_target parameters. These are used to be able to
iterate over threads and inferiors of a given target. Following usual
conventions, if the target pointer is null, then we iterate over
threads and inferiors of all targets.
I tried converting "add-inferior" to the gdb::option framework, as a
preparatory patch, but that stumbled on the fact that gdb::option does
not support file options yet, for "add-inferior -exec". I have a WIP
patchset that adds that, but it's not a trivial patch, mainly due to
need to integrate readline's filename completion, so I deferred that
to some other time.
In infrun.c/infcmd.c, the main change is that we need to poll events
out of all targets. See do_target_wait. Right after collecting an
event, we switch the current inferior to an inferior bound to the
target that reported the event, so that target methods can be used
while handling the event. This makes most of the code transparent to
multi-targets. See fetch_inferior_event.
infrun.c:stop_all_threads is interesting -- in this function we need
to stop all threads of all targets. What the function does is send an
asynchronous stop request to all threads, and then synchronously waits
for events, with target_wait, rinse repeat, until all it finds are
stopped threads. Now that we have multiple targets, it's not
efficient to synchronously block in target_wait waiting for events out
of one target. Instead, we implement a mini event loop, with
interruptible_select, select'ing on one file descriptor per target.
For this to work, we need to be able to ask the target for a waitable
file descriptor. Such file descriptors already exist, they are the
descriptors registered in the main event loop with add_file_handler,
inside the target_async implementations. This commit adds a new
target_async_wait_fd target method that just returns the file
descriptor in question. See wait_one / stop_all_threads in infrun.c.
The 'threads_executing' global is made a per-target variable. Since
it is only relevant to process_stratum_target targets, this is where
it is put, instead of in target_ops.
You'll notice that remote.c includes some FIXME notes. These refer to
the fact that the global arrays that hold data for the remote packets
supported are still globals. For example, if we connect to two
different servers/stubs, then each might support different remote
protocol features. They might even be different architectures, like
e.g., one ARM baremetal stub, and a x86 gdbserver, to debug a
host/controller scenario as a single program. That isn't going to
work correctly today, because of said globals. I'm leaving fixing
that for another pass, since it does not appear to be trivial, and I'd
rather land the base work first. It's already useful to be able to
debug multiple instances of the same server (e.g., a distributed
cluster, where you have full control over the servers installed), so I
think as is it's already reasonable incremental progress.
Current limitations:
- You can only resume more that one target at the same time if all
targets support asynchronous debugging, and support non-stop mode.
It should be possible to support mixed all-stop + non-stop
backends, but that is left for another time. This means that
currently in order to do multi-target with gdbserver you need to
issue "maint set target-non-stop on". I would like to make that
mode be the default, but we're not there yet. Note that I'm
talking about how the target backend works, only. User-visible
all-stop mode works just fine.
- As explained above, connecting to different remote servers at the
same time is likely to produce bad results if they don't support the
exact set of RSP features.
FreeBSD updates courtesy of John Baldwin.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@FreeBSD.org>
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Adjust.
* ada-tasks.c (print_ada_task_info): Adjust find_thread_ptid call.
(task_command_1): Likewise.
* aix-thread.c (sync_threadlists, aix_thread_target::resume)
(aix_thread_target::wait, aix_thread_target::fetch_registers)
(aix_thread_target::store_registers)
(aix_thread_target::thread_alive): Adjust.
* amd64-fbsd-tdep.c: Include "inferior.h".
(amd64fbsd_get_thread_local_address): Pass down target.
* amd64-linux-nat.c (ps_get_thread_area): Use ps_prochandle
thread's gdbarch instead of target_gdbarch.
* break-catch-sig.c (signal_catchpoint_print_it): Adjust call to
get_last_target_status.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
* breakpoint.c (breakpoints_should_be_inserted_now): Consider all
inferiors.
(update_inserted_breakpoint_locations): Skip if inferiors with no
execution.
(update_global_location_list): When handling moribund locations,
find representative inferior for location's pspace, and use thread
count of its process_stratum target.
* bsd-kvm.c (bsd_kvm_target_open): Pass target down.
* bsd-uthread.c (bsd_uthread_target::wait): Use
as_process_stratum_target and adjust thread_change_ptid and
add_thread calls.
(bsd_uthread_target::update_thread_list): Use
as_process_stratum_target and adjust find_thread_ptid,
thread_change_ptid and add_thread calls.
* btrace.c (maint_btrace_packet_history_cmd): Adjust
find_thread_ptid call.
* corelow.c (add_to_thread_list): Adjust add_thread call.
(core_target_open): Adjust add_thread_silent and thread_count
calls.
(core_target::pid_to_str): Adjust find_inferior_ptid call.
* ctf.c (ctf_target_open): Adjust add_thread_silent call.
* event-top.c (async_disconnect): Pop targets from all inferiors.
* exec.c (add_target_sections): Push exec target on all inferiors
sharing the program space.
(remove_target_sections): Remove the exec target from all
inferiors sharing the program space.
(exec_on_vfork): New.
* exec.h (exec_on_vfork): Declare.
* fbsd-nat.c (fbsd_add_threads): Add fbsd_nat_target parameter.
Pass it down.
(fbsd_nat_target::update_thread_list): Adjust.
(fbsd_nat_target::resume): Adjust.
(fbsd_handle_debug_trap): Add fbsd_nat_target parameter. Pass it
down.
(fbsd_nat_target::wait, fbsd_nat_target::post_attach): Adjust.
* fbsd-tdep.c (fbsd_corefile_thread): Adjust
get_thread_arch_regcache call.
* fork-child.c (gdb_startup_inferior): Pass target down to
startup_inferior and set_executing.
* gdbthread.h (struct process_stratum_target): Forward declare.
(add_thread, add_thread_silent, add_thread_with_info)
(in_thread_list): Add process_stratum_target parameter.
(find_thread_ptid(inferior*, ptid_t)): New overload.
(find_thread_ptid, thread_change_ptid): Add process_stratum_target
parameter.
(all_threads()): Delete overload.
(all_threads, all_non_exited_threads): Add process_stratum_target
parameter.
(all_threads_safe): Use brace initialization.
(thread_count): Add process_stratum_target parameter.
(set_resumed, set_running, set_stop_requested, set_executing)
(threads_are_executing, finish_thread_state): Add
process_stratum_target parameter.
(switch_to_thread): Use is_current_thread.
* i386-fbsd-tdep.c: Include "inferior.h".
(i386fbsd_get_thread_local_address): Pass down target.
* i386-linux-nat.c (i386_linux_nat_target::low_resume): Adjust.
* inf-child.c (inf_child_target::maybe_unpush_target): Remove
have_inferiors check.
* inf-ptrace.c (inf_ptrace_target::create_inferior)
(inf_ptrace_target::attach): Adjust.
* infcall.c (run_inferior_call): Adjust.
* infcmd.c (run_command_1): Pass target to
scoped_finish_thread_state.
(proceed_thread_callback): Skip inferiors with no execution.
(continue_command): Rename 'all_threads' local to avoid hiding
'all_threads' function. Adjust get_last_target_status call.
(prepare_one_step): Adjust set_running call.
(signal_command): Use user_visible_resume_target. Compare thread
pointers instead of inferior_ptid.
(info_program_command): Adjust to pass down target.
(attach_command): Mark target's 'thread_executing' flag.
(stop_current_target_threads_ns): New, factored out from ...
(interrupt_target_1): ... this. Switch inferior before making
target calls.
* inferior-iter.h
(struct all_inferiors_iterator, struct all_inferiors_range)
(struct all_inferiors_safe_range)
(struct all_non_exited_inferiors_range): Filter on
process_stratum_target too. Remove explicit.
* inferior.c (inferior::inferior): Push dummy target on target
stack.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors):
Add process_stratum_target parameter, and pass it down.
(have_live_inferiors): Adjust.
(switch_to_inferior_and_push_target): New.
(add_inferior_command, clone_inferior_command): Handle
"-no-connection" parameter. Use
switch_to_inferior_and_push_target.
(_initialize_inferior): Mention "-no-connection" option in
the help of "add-inferior" and "clone-inferior" commands.
* inferior.h: Include "process-stratum-target.h".
(interrupt_target_1): Use bool.
(struct inferior) <push_target, unpush_target, target_is_pushed,
find_target_beneath, top_target, process_target, target_at,
m_stack>: New.
(discard_all_inferiors): Delete.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors)
(all_inferiors, all_non_exited_inferiors): Add
process_stratum_target parameter.
* infrun.c: Include "gdb_select.h" and <unordered_map>.
(target_last_proc_target): New global.
(follow_fork_inferior): Push target on new inferior. Pass target
to add_thread_silent. Call exec_on_vfork. Handle target's
reference count.
(follow_fork): Adjust get_last_target_status call. Also consider
target.
(follow_exec): Push target on new inferior.
(struct execution_control_state) <target>: New field.
(user_visible_resume_target): New.
(do_target_resume): Call target_async.
(resume_1): Set target's threads_executing flag. Consider resume
target.
(commit_resume_all_targets): New.
(proceed): Also consider resume target. Skip threads of inferiors
with no execution. Commit resumtion in all targets.
(start_remote): Pass current inferior to wait_for_inferior.
(infrun_thread_stop_requested): Consider target as well. Pass
thread_info pointer to clear_inline_frame_state instead of ptid.
(infrun_thread_thread_exit): Consider target as well.
(random_pending_event_thread): New inferior parameter. Use it.
(do_target_wait): Rename to ...
(do_target_wait_1): ... this. Add inferior parameter, and pass it
down.
(threads_are_resumed_pending_p, do_target_wait): New.
(prepare_for_detach): Adjust calls.
(wait_for_inferior): New inferior parameter. Handle it. Use
do_target_wait_1 instead of do_target_wait.
(fetch_inferior_event): Adjust. Switch to representative
inferior. Pass target down.
(set_last_target_status): Add process_stratum_target parameter.
Save target in global.
(get_last_target_status): Add process_stratum_target parameter and
handle it.
(nullify_last_target_wait_ptid): Clear 'target_last_proc_target'.
(context_switch): Check inferior_ptid == null_ptid before calling
inferior_thread().
(get_inferior_stop_soon): Pass down target.
(wait_one): Rename to ...
(poll_one_curr_target): ... this.
(struct wait_one_event): New.
(wait_one): New.
(stop_all_threads): Adjust.
(handle_no_resumed, handle_inferior_event): Adjust to consider the
event's target.
(switch_back_to_stepped_thread): Also consider target.
(print_stop_event): Update.
(normal_stop): Update. Also consider the resume target.
* infrun.h (wait_for_inferior): Remove declaration.
(user_visible_resume_target): New declaration.
(get_last_target_status, set_last_target_status): New
process_stratum_target parameter.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter, and use it.
(clear_inline_frame_state (thread_info*)): New.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter.
(clear_inline_frame_state (thread_info*)): Declare.
* linux-fork.c (delete_checkpoint_command): Pass target down to
find_thread_ptid.
(checkpoint_command): Adjust.
* linux-nat.c (linux_nat_target::follow_fork): Switch to thread
instead of just tweaking inferior_ptid.
(linux_nat_switch_fork): Pass target down to thread_change_ptid.
(exit_lwp): Pass target down to find_thread_ptid.
(attach_proc_task_lwp_callback): Pass target down to
add_thread/set_running/set_executing.
(linux_nat_target::attach): Pass target down to
thread_change_ptid.
(get_detach_signal): Pass target down to find_thread_ptid.
Consider last target status's target.
(linux_resume_one_lwp_throw, resume_lwp)
(linux_handle_syscall_trap, linux_handle_extended_wait, wait_lwp)
(stop_wait_callback, save_stop_reason, linux_nat_filter_event)
(linux_nat_wait_1, resume_stopped_resumed_lwps): Pass target down.
(linux_nat_target::async_wait_fd): New.
(linux_nat_stop_lwp, linux_nat_target::thread_address_space): Pass
target down.
* linux-nat.h (linux_nat_target::async_wait_fd): Declare.
* linux-tdep.c (get_thread_arch_regcache): Pass target down.
* linux-thread-db.c (struct thread_db_info::process_target): New
field.
(add_thread_db_info): Save target.
(get_thread_db_info): New process_stratum_target parameter. Also
match target.
(delete_thread_db_info): New process_stratum_target parameter.
Also match target.
(thread_from_lwp): Adjust to pass down target.
(thread_db_notice_clone): Pass down target.
(check_thread_db_callback): Pass down target.
(try_thread_db_load_1): Always push the thread_db target.
(try_thread_db_load, record_thread): Pass target down.
(thread_db_target::detach): Pass target down. Always unpush the
thread_db target.
(thread_db_target::wait, thread_db_target::mourn_inferior): Pass
target down. Always unpush the thread_db target.
(find_new_threads_callback, thread_db_find_new_threads_2)
(thread_db_target::update_thread_list): Pass target down.
(thread_db_target::pid_to_str): Pass current inferior down.
(thread_db_target::get_thread_local_address): Pass target down.
(thread_db_target::resume, maintenance_check_libthread_db): Pass
target down.
* nto-procfs.c (nto_procfs_target::update_thread_list): Adjust.
* procfs.c (procfs_target::procfs_init_inferior): Declare.
(proc_set_current_signal, do_attach, procfs_target::wait): Adjust.
(procfs_init_inferior): Rename to ...
(procfs_target::procfs_init_inferior): ... this and adjust.
(procfs_target::create_inferior, procfs_notice_thread)
(procfs_do_thread_registers): Adjust.
* ppc-fbsd-tdep.c: Include "inferior.h".
(ppcfbsd_get_thread_local_address): Pass down target.
* proc-service.c (ps_xfer_memory): Switch current inferior and
program space as well.
(get_ps_regcache): Pass target down.
* process-stratum-target.c
(process_stratum_target::thread_address_space)
(process_stratum_target::thread_architecture): Pass target down.
* process-stratum-target.h
(process_stratum_target::threads_executing): New field.
(as_process_stratum_target): New.
* ravenscar-thread.c
(ravenscar_thread_target::update_inferior_ptid): Pass target down.
(ravenscar_thread_target::wait, ravenscar_add_thread): Pass target
down.
* record-btrace.c (record_btrace_target::info_record): Adjust.
(record_btrace_target::record_method)
(record_btrace_target::record_is_replaying)
(record_btrace_target::fetch_registers)
(get_thread_current_frame_id, record_btrace_target::resume)
(record_btrace_target::wait, record_btrace_target::stop): Pass
target down.
* record-full.c (record_full_wait_1): Switch to event thread.
Pass target down.
* regcache.c (regcache::regcache)
(get_thread_arch_aspace_regcache, get_thread_arch_regcache): Add
process_stratum_target parameter and handle it.
(current_thread_target): New global.
(get_thread_regcache): Add process_stratum_target parameter and
handle it. Switch inferior before calling target method.
(get_thread_regcache): Pass target down.
(get_thread_regcache_for_ptid): Pass target down.
(registers_changed_ptid): Add process_stratum_target parameter and
handle it.
(registers_changed_thread, registers_changed): Pass target down.
(test_get_thread_arch_aspace_regcache): New.
(current_regcache_test): Define a couple local test_target_ops
instances and use them for testing.
(readwrite_regcache): Pass process_stratum_target parameter.
(cooked_read_test, cooked_write_test): Pass mock_target down.
* regcache.h (get_thread_regcache, get_thread_arch_regcache)
(get_thread_arch_aspace_regcache): Add process_stratum_target
parameter.
(regcache::target): New method.
(regcache::regcache, regcache::get_thread_arch_aspace_regcache)
(regcache::registers_changed_ptid): Add process_stratum_target
parameter.
(regcache::m_target): New field.
(registers_changed_ptid): Add process_stratum_target parameter.
* remote.c (remote_state::supports_vCont_probed): New field.
(remote_target::async_wait_fd): New method.
(remote_unpush_and_throw): Add remote_target parameter.
(get_current_remote_target): Adjust.
(remote_target::remote_add_inferior): Push target.
(remote_target::remote_add_thread)
(remote_target::remote_notice_new_inferior)
(get_remote_thread_info): Pass target down.
(remote_target::update_thread_list): Skip threads of inferiors
bound to other targets. (remote_target::close): Don't discard
inferiors. (remote_target::add_current_inferior_and_thread)
(remote_target::process_initial_stop_replies)
(remote_target::start_remote)
(remote_target::remote_serial_quit_handler): Pass down target.
(remote_target::remote_unpush_target): New remote_target
parameter. Unpush the target from all inferiors.
(remote_target::remote_unpush_and_throw): New remote_target
parameter. Pass it down.
(remote_target::open_1): Check whether the current inferior has
execution instead of checking whether any inferior is live. Pass
target down.
(remote_target::remote_detach_1): Pass down target. Use
remote_unpush_target.
(extended_remote_target::attach): Pass down target.
(remote_target::remote_vcont_probe): Set supports_vCont_probed.
(remote_target::append_resumption): Pass down target.
(remote_target::append_pending_thread_resumptions)
(remote_target::remote_resume_with_hc, remote_target::resume)
(remote_target::commit_resume): Pass down target.
(remote_target::remote_stop_ns): Check supports_vCont_probed.
(remote_target::interrupt_query)
(remote_target::remove_new_fork_children)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::remote_parse_stop_reply)
(remote_target::process_stop_reply): Pass down target.
(first_remote_resumed_thread): New remote_target parameter. Pass
it down.
(remote_target::wait_as): Pass down target.
(unpush_and_perror): New remote_target parameter. Pass it down.
(remote_target::readchar, remote_target::remote_serial_write)
(remote_target::getpkt_or_notif_sane_1)
(remote_target::kill_new_fork_children, remote_target::kill): Pass
down target.
(remote_target::mourn_inferior): Pass down target. Use
remote_unpush_target.
(remote_target::core_of_thread)
(remote_target::remote_btrace_maybe_reopen): Pass down target.
(remote_target::pid_to_exec_file)
(remote_target::thread_handle_to_thread_info): Pass down target.
(remote_target::async_wait_fd): New.
* riscv-fbsd-tdep.c: Include "inferior.h".
(riscv_fbsd_get_thread_local_address): Pass down target.
* sol2-tdep.c (sol2_core_pid_to_str): Pass down target.
* sol-thread.c (sol_thread_target::wait, ps_lgetregs, ps_lsetregs)
(ps_lgetfpregs, ps_lsetfpregs, sol_update_thread_list_callback):
Adjust.
* solib-spu.c (spu_skip_standalone_loader): Pass down target.
* solib-svr4.c (enable_break): Pass down target.
* spu-multiarch.c (parse_spufs_run): Pass down target.
* spu-tdep.c (spu2ppu_sniffer): Pass down target.
* target-delegates.c: Regenerate.
* target.c (g_target_stack): Delete.
(current_top_target): Return the current inferior's top target.
(target_has_execution_1): Refer to the passed-in inferior's top
target.
(target_supports_terminal_ours): Check whether the initial
inferior was already created.
(decref_target): New.
(target_stack::push): Incref/decref the target.
(push_target, push_target, unpush_target): Adjust.
(target_stack::unpush): Defref target.
(target_is_pushed): Return bool. Adjust to refer to the current
inferior's target stack.
(dispose_inferior): Delete, and inline parts ...
(target_preopen): ... here. Only dispose of the current inferior.
(target_detach): Hold strong target reference while detaching.
Pass target down.
(target_thread_name): Add assertion.
(target_resume): Pass down target.
(target_ops::beneath, find_target_at): Adjust to refer to the
current inferior's target stack.
(get_dummy_target): New.
(target_pass_ctrlc): Pass the Ctrl-C to the first inferior that
has a thread running.
(initialize_targets): Rename to ...
(_initialize_target): ... this.
* target.h: Include "gdbsupport/refcounted-object.h".
(struct target_ops): Inherit refcounted_object.
(target_ops::shortname, target_ops::longname): Make const.
(target_ops::async_wait_fd): New method.
(decref_target): Declare.
(struct target_ops_ref_policy): New.
(target_ops_ref): New typedef.
(get_dummy_target): Declare function.
(target_is_pushed): Return bool.
* thread-iter.c (all_matching_threads_iterator::m_inf_matches)
(all_matching_threads_iterator::all_matching_threads_iterator):
Handle filter target.
* thread-iter.h (struct all_matching_threads_iterator, struct
all_matching_threads_range, class all_non_exited_threads_range):
Filter by target too. Remove explicit.
* thread.c (threads_executing): Delete.
(inferior_thread): Pass down current inferior.
(clear_thread_inferior_resources): Pass down thread pointer
instead of ptid_t.
(add_thread_silent, add_thread_with_info, add_thread): Add
process_stratum_target parameter. Use it for thread and inferior
searches.
(is_current_thread): New.
(thread_info::deletable): Use it.
(find_thread_ptid, thread_count, in_thread_list)
(thread_change_ptid, set_resumed, set_running): New
process_stratum_target parameter. Pass it down.
(set_executing): New process_stratum_target parameter. Pass it
down. Adjust reference to 'threads_executing'.
(threads_are_executing): New process_stratum_target parameter.
Adjust reference to 'threads_executing'.
(set_stop_requested, finish_thread_state): New
process_stratum_target parameter. Pass it down.
(switch_to_thread): Also match inferior.
(switch_to_thread): New process_stratum_target parameter. Pass it
down.
(update_threads_executing): Reimplement.
* top.c (quit_force): Pop targets from all inferior.
(gdb_init): Don't call initialize_targets.
* windows-nat.c (windows_nat_target) <get_windows_debug_event>:
Declare.
(windows_add_thread, windows_delete_thread): Adjust.
(get_windows_debug_event): Rename to ...
(windows_nat_target::get_windows_debug_event): ... this. Adjust.
* tracefile-tfile.c (tfile_target_open): Pass down target.
* gdbsupport/common-gdbthread.h (struct process_stratum_target):
Forward declare.
(switch_to_thread): Add process_stratum_target parameter.
* mi/mi-interp.c (mi_on_resume_1): Add process_stratum_target
parameter. Use it.
(mi_on_resume): Pass target down.
* nat/fork-inferior.c (startup_inferior): Add
process_stratum_target parameter. Pass it down.
* nat/fork-inferior.h (startup_inferior): Add
process_stratum_target parameter.
* python/py-threadevent.c (py_get_event_thread): Pass target down.
gdb/gdbserver/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* fork-child.c (post_fork_inferior): Pass target down to
startup_inferior.
* inferiors.c (switch_to_thread): Add process_stratum_target
parameter.
* lynx-low.c (lynx_target_ops): Now a process_stratum_target.
* nto-low.c (nto_target_ops): Now a process_stratum_target.
* linux-low.c (linux_target_ops): Now a process_stratum_target.
* remote-utils.c (prepare_resume_reply): Pass the target to
switch_to_thread.
* target.c (the_target): Now a process_stratum_target.
(done_accessing_memory): Pass the target to switch_to_thread.
(set_target_ops): Ajust to use process_stratum_target.
* target.h (struct target_ops): Rename to ...
(struct process_stratum_target): ... this.
(the_target, set_target_ops): Adjust.
(prepare_to_access_memory): Adjust comment.
* win32-low.c (child_xfer_memory): Adjust to use
process_stratum_target.
(win32_target_ops): Now a process_stratum_target.
2020-01-10 21:06:08 +01:00
|
|
|
process_stratum_target *proc_target
|
|
|
|
= current_inferior ()->process_target ();
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Try to insert the software single step breakpoint.
|
|
|
|
If insert success, set step to 0. */
|
2020-02-04 05:02:28 +01:00
|
|
|
set_executing (proc_target, inferior_ptid, false);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
reinit_frame_cache ();
|
2016-11-08 15:28:32 +01:00
|
|
|
|
|
|
|
step = !insert_single_step_breakpoints (gdbarch);
|
|
|
|
|
2020-02-04 05:02:28 +01:00
|
|
|
set_executing (proc_target, inferior_ptid, true);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"Process record: record_full_wait "
|
|
|
|
"issuing one more step in the "
|
|
|
|
"target beneath\n");
|
2018-06-07 18:27:47 +02:00
|
|
|
ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
|
|
|
|
ops->beneath ()->commit_resume ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The inferior is broken by a breakpoint or a signal. */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Multi-target support
This commit adds multi-target support to GDB. What this means is that
with this commit, GDB can now be connected to different targets at the
same time. E.g., you can debug a live native process and a core dump
at the same time, connect to multiple gdbservers, etc.
Actually, the word "target" is overloaded in gdb. We already have a
target stack, with pushes several target_ops instances on top of one
another. We also have "info target" already, which means something
completely different to what this patch does.
So from here on, I'll be using the "target connections" term, to mean
an open process_stratum target, pushed on a target stack. This patch
makes gdb have multiple target stacks, and multiple process_stratum
targets open simultaneously. The user-visible changes / commands will
also use this terminology, but of course it's all open to debate.
User-interface-wise, not that much changes. The main difference is
that each inferior may have its own target connection.
A target connection (e.g., a target extended-remote connection) may
support debugging multiple processes, just as before.
Say you're debugging against gdbserver in extended-remote mode, and
you do "add-inferior" to prepare to spawn a new process, like:
(gdb) target extended-remote :9999
...
(gdb) start
...
(gdb) add-inferior
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) file a.out
...
(gdb) start
...
At this point, you have two inferiors connected to the same gdbserver.
With this commit, GDB will maintain a target stack per inferior,
instead of a global target stack.
To preserve the behavior above, by default, "add-inferior" makes the
new inferior inherit a copy of the target stack of the current
inferior. Same across a fork - the child inherits a copy of the
target stack of the parent. While the target stacks are copied, the
targets themselves are not. Instead, target_ops is made a
refcounted_object, which means that target_ops instances are
refcounted, which each inferior counting for a reference.
What if you want to create an inferior and connect it to some _other_
target? For that, this commit introduces a new "add-inferior
-no-connection" option that makes the new inferior not share the
current inferior's target. So you could do:
(gdb) target extended-remote :9999
Remote debugging using :9999
...
(gdb) add-inferior -no-connection
[New inferior 2]
Added inferior 2
(gdb) inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 <null>
(gdb) tar extended-remote :10000
Remote debugging using :10000
...
(gdb) info inferiors
Num Description Executable
1 process 18401 target:/home/pedro/tmp/main
* 2 process 18450 target:/home/pedro/tmp/main
(gdb)
A following patch will extended "info inferiors" to include a column
indicating which connection an inferior is bound to, along with a
couple other UI tweaks.
Other than that, debugging is the same as before. Users interact with
inferiors and threads as before. The only difference is that
inferiors may be bound to processes running in different machines.
That's pretty much all there is to it in terms of noticeable UI
changes.
On to implementation.
Since we can be connected to different systems at the same time, a
ptid_t is no longer a unique identifier. Instead a thread can be
identified by a pair of ptid_t and 'process_stratum_target *', the
later being the instance of the process_stratum target that owns the
process/thread. Note that process_stratum_target inherits from
target_ops, and all process_stratum targets inherit from
process_stratum_target. In earlier patches, many places in gdb were
converted to refer to threads by thread_info pointer instead of
ptid_t, but there are still places in gdb where we start with a
pid/tid and need to find the corresponding inferior or thread_info
objects. So you'll see in the patch many places adding a
process_stratum_target parameter to functions that used to take only a
ptid_t.
Since each inferior has its own target stack now, we can always find
the process_stratum target for an inferior. That is done via a
inf->process_target() convenience method.
Since each inferior has its own target stack, we need to handle the
"beneath" calls when servicing target calls. The solution I settled
with is just to make sure to switch the current inferior to the
inferior you want before making a target call. Not relying on global
context is just not feasible in current GDB. Fortunately, there
aren't that many places that need to do that, because generally most
code that calls target methods already has the current context
pointing to the right inferior/thread. Note, to emphasize -- there's
no method to "switch to this target stack". Instead, you switch the
current inferior, and that implicitly switches the target stack.
In some spots, we need to iterate over all inferiors so that we reach
all target stacks.
Native targets are still singletons. There's always only a single
instance of such targets.
Remote targets however, we'll have one instance per remote connection.
The exec target is still a singleton. There's only one instance. I
did not see the point of instanciating more than one exec_target
object.
After vfork, we need to make sure to push the exec target on the new
inferior. See exec_on_vfork.
For type safety, functions that need a {target, ptid} pair to identify
a thread, take a process_stratum_target pointer for target parameter
instead of target_ops *. Some shared code in gdb/nat/ also need to
gain a target pointer parameter. This poses an issue, since gdbserver
doesn't have process_stratum_target, only target_ops. To fix this,
this commit renames gdbserver's target_ops to process_stratum_target.
I think this makes sense. There's no concept of target stack in
gdbserver, and gdbserver's target_ops really implements a
process_stratum-like target.
The thread and inferior iterator functions also gain
process_stratum_target parameters. These are used to be able to
iterate over threads and inferiors of a given target. Following usual
conventions, if the target pointer is null, then we iterate over
threads and inferiors of all targets.
I tried converting "add-inferior" to the gdb::option framework, as a
preparatory patch, but that stumbled on the fact that gdb::option does
not support file options yet, for "add-inferior -exec". I have a WIP
patchset that adds that, but it's not a trivial patch, mainly due to
need to integrate readline's filename completion, so I deferred that
to some other time.
In infrun.c/infcmd.c, the main change is that we need to poll events
out of all targets. See do_target_wait. Right after collecting an
event, we switch the current inferior to an inferior bound to the
target that reported the event, so that target methods can be used
while handling the event. This makes most of the code transparent to
multi-targets. See fetch_inferior_event.
infrun.c:stop_all_threads is interesting -- in this function we need
to stop all threads of all targets. What the function does is send an
asynchronous stop request to all threads, and then synchronously waits
for events, with target_wait, rinse repeat, until all it finds are
stopped threads. Now that we have multiple targets, it's not
efficient to synchronously block in target_wait waiting for events out
of one target. Instead, we implement a mini event loop, with
interruptible_select, select'ing on one file descriptor per target.
For this to work, we need to be able to ask the target for a waitable
file descriptor. Such file descriptors already exist, they are the
descriptors registered in the main event loop with add_file_handler,
inside the target_async implementations. This commit adds a new
target_async_wait_fd target method that just returns the file
descriptor in question. See wait_one / stop_all_threads in infrun.c.
The 'threads_executing' global is made a per-target variable. Since
it is only relevant to process_stratum_target targets, this is where
it is put, instead of in target_ops.
You'll notice that remote.c includes some FIXME notes. These refer to
the fact that the global arrays that hold data for the remote packets
supported are still globals. For example, if we connect to two
different servers/stubs, then each might support different remote
protocol features. They might even be different architectures, like
e.g., one ARM baremetal stub, and a x86 gdbserver, to debug a
host/controller scenario as a single program. That isn't going to
work correctly today, because of said globals. I'm leaving fixing
that for another pass, since it does not appear to be trivial, and I'd
rather land the base work first. It's already useful to be able to
debug multiple instances of the same server (e.g., a distributed
cluster, where you have full control over the servers installed), so I
think as is it's already reasonable incremental progress.
Current limitations:
- You can only resume more that one target at the same time if all
targets support asynchronous debugging, and support non-stop mode.
It should be possible to support mixed all-stop + non-stop
backends, but that is left for another time. This means that
currently in order to do multi-target with gdbserver you need to
issue "maint set target-non-stop on". I would like to make that
mode be the default, but we're not there yet. Note that I'm
talking about how the target backend works, only. User-visible
all-stop mode works just fine.
- As explained above, connecting to different remote servers at the
same time is likely to produce bad results if they don't support the
exact set of RSP features.
FreeBSD updates courtesy of John Baldwin.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@FreeBSD.org>
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Adjust.
* ada-tasks.c (print_ada_task_info): Adjust find_thread_ptid call.
(task_command_1): Likewise.
* aix-thread.c (sync_threadlists, aix_thread_target::resume)
(aix_thread_target::wait, aix_thread_target::fetch_registers)
(aix_thread_target::store_registers)
(aix_thread_target::thread_alive): Adjust.
* amd64-fbsd-tdep.c: Include "inferior.h".
(amd64fbsd_get_thread_local_address): Pass down target.
* amd64-linux-nat.c (ps_get_thread_area): Use ps_prochandle
thread's gdbarch instead of target_gdbarch.
* break-catch-sig.c (signal_catchpoint_print_it): Adjust call to
get_last_target_status.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
* breakpoint.c (breakpoints_should_be_inserted_now): Consider all
inferiors.
(update_inserted_breakpoint_locations): Skip if inferiors with no
execution.
(update_global_location_list): When handling moribund locations,
find representative inferior for location's pspace, and use thread
count of its process_stratum target.
* bsd-kvm.c (bsd_kvm_target_open): Pass target down.
* bsd-uthread.c (bsd_uthread_target::wait): Use
as_process_stratum_target and adjust thread_change_ptid and
add_thread calls.
(bsd_uthread_target::update_thread_list): Use
as_process_stratum_target and adjust find_thread_ptid,
thread_change_ptid and add_thread calls.
* btrace.c (maint_btrace_packet_history_cmd): Adjust
find_thread_ptid call.
* corelow.c (add_to_thread_list): Adjust add_thread call.
(core_target_open): Adjust add_thread_silent and thread_count
calls.
(core_target::pid_to_str): Adjust find_inferior_ptid call.
* ctf.c (ctf_target_open): Adjust add_thread_silent call.
* event-top.c (async_disconnect): Pop targets from all inferiors.
* exec.c (add_target_sections): Push exec target on all inferiors
sharing the program space.
(remove_target_sections): Remove the exec target from all
inferiors sharing the program space.
(exec_on_vfork): New.
* exec.h (exec_on_vfork): Declare.
* fbsd-nat.c (fbsd_add_threads): Add fbsd_nat_target parameter.
Pass it down.
(fbsd_nat_target::update_thread_list): Adjust.
(fbsd_nat_target::resume): Adjust.
(fbsd_handle_debug_trap): Add fbsd_nat_target parameter. Pass it
down.
(fbsd_nat_target::wait, fbsd_nat_target::post_attach): Adjust.
* fbsd-tdep.c (fbsd_corefile_thread): Adjust
get_thread_arch_regcache call.
* fork-child.c (gdb_startup_inferior): Pass target down to
startup_inferior and set_executing.
* gdbthread.h (struct process_stratum_target): Forward declare.
(add_thread, add_thread_silent, add_thread_with_info)
(in_thread_list): Add process_stratum_target parameter.
(find_thread_ptid(inferior*, ptid_t)): New overload.
(find_thread_ptid, thread_change_ptid): Add process_stratum_target
parameter.
(all_threads()): Delete overload.
(all_threads, all_non_exited_threads): Add process_stratum_target
parameter.
(all_threads_safe): Use brace initialization.
(thread_count): Add process_stratum_target parameter.
(set_resumed, set_running, set_stop_requested, set_executing)
(threads_are_executing, finish_thread_state): Add
process_stratum_target parameter.
(switch_to_thread): Use is_current_thread.
* i386-fbsd-tdep.c: Include "inferior.h".
(i386fbsd_get_thread_local_address): Pass down target.
* i386-linux-nat.c (i386_linux_nat_target::low_resume): Adjust.
* inf-child.c (inf_child_target::maybe_unpush_target): Remove
have_inferiors check.
* inf-ptrace.c (inf_ptrace_target::create_inferior)
(inf_ptrace_target::attach): Adjust.
* infcall.c (run_inferior_call): Adjust.
* infcmd.c (run_command_1): Pass target to
scoped_finish_thread_state.
(proceed_thread_callback): Skip inferiors with no execution.
(continue_command): Rename 'all_threads' local to avoid hiding
'all_threads' function. Adjust get_last_target_status call.
(prepare_one_step): Adjust set_running call.
(signal_command): Use user_visible_resume_target. Compare thread
pointers instead of inferior_ptid.
(info_program_command): Adjust to pass down target.
(attach_command): Mark target's 'thread_executing' flag.
(stop_current_target_threads_ns): New, factored out from ...
(interrupt_target_1): ... this. Switch inferior before making
target calls.
* inferior-iter.h
(struct all_inferiors_iterator, struct all_inferiors_range)
(struct all_inferiors_safe_range)
(struct all_non_exited_inferiors_range): Filter on
process_stratum_target too. Remove explicit.
* inferior.c (inferior::inferior): Push dummy target on target
stack.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors):
Add process_stratum_target parameter, and pass it down.
(have_live_inferiors): Adjust.
(switch_to_inferior_and_push_target): New.
(add_inferior_command, clone_inferior_command): Handle
"-no-connection" parameter. Use
switch_to_inferior_and_push_target.
(_initialize_inferior): Mention "-no-connection" option in
the help of "add-inferior" and "clone-inferior" commands.
* inferior.h: Include "process-stratum-target.h".
(interrupt_target_1): Use bool.
(struct inferior) <push_target, unpush_target, target_is_pushed,
find_target_beneath, top_target, process_target, target_at,
m_stack>: New.
(discard_all_inferiors): Delete.
(find_inferior_pid, find_inferior_ptid, number_of_live_inferiors)
(all_inferiors, all_non_exited_inferiors): Add
process_stratum_target parameter.
* infrun.c: Include "gdb_select.h" and <unordered_map>.
(target_last_proc_target): New global.
(follow_fork_inferior): Push target on new inferior. Pass target
to add_thread_silent. Call exec_on_vfork. Handle target's
reference count.
(follow_fork): Adjust get_last_target_status call. Also consider
target.
(follow_exec): Push target on new inferior.
(struct execution_control_state) <target>: New field.
(user_visible_resume_target): New.
(do_target_resume): Call target_async.
(resume_1): Set target's threads_executing flag. Consider resume
target.
(commit_resume_all_targets): New.
(proceed): Also consider resume target. Skip threads of inferiors
with no execution. Commit resumtion in all targets.
(start_remote): Pass current inferior to wait_for_inferior.
(infrun_thread_stop_requested): Consider target as well. Pass
thread_info pointer to clear_inline_frame_state instead of ptid.
(infrun_thread_thread_exit): Consider target as well.
(random_pending_event_thread): New inferior parameter. Use it.
(do_target_wait): Rename to ...
(do_target_wait_1): ... this. Add inferior parameter, and pass it
down.
(threads_are_resumed_pending_p, do_target_wait): New.
(prepare_for_detach): Adjust calls.
(wait_for_inferior): New inferior parameter. Handle it. Use
do_target_wait_1 instead of do_target_wait.
(fetch_inferior_event): Adjust. Switch to representative
inferior. Pass target down.
(set_last_target_status): Add process_stratum_target parameter.
Save target in global.
(get_last_target_status): Add process_stratum_target parameter and
handle it.
(nullify_last_target_wait_ptid): Clear 'target_last_proc_target'.
(context_switch): Check inferior_ptid == null_ptid before calling
inferior_thread().
(get_inferior_stop_soon): Pass down target.
(wait_one): Rename to ...
(poll_one_curr_target): ... this.
(struct wait_one_event): New.
(wait_one): New.
(stop_all_threads): Adjust.
(handle_no_resumed, handle_inferior_event): Adjust to consider the
event's target.
(switch_back_to_stepped_thread): Also consider target.
(print_stop_event): Update.
(normal_stop): Update. Also consider the resume target.
* infrun.h (wait_for_inferior): Remove declaration.
(user_visible_resume_target): New declaration.
(get_last_target_status, set_last_target_status): New
process_stratum_target parameter.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter, and use it.
(clear_inline_frame_state (thread_info*)): New.
* inline-frame.c (clear_inline_frame_state(ptid_t)): Add
process_stratum_target parameter.
(clear_inline_frame_state (thread_info*)): Declare.
* linux-fork.c (delete_checkpoint_command): Pass target down to
find_thread_ptid.
(checkpoint_command): Adjust.
* linux-nat.c (linux_nat_target::follow_fork): Switch to thread
instead of just tweaking inferior_ptid.
(linux_nat_switch_fork): Pass target down to thread_change_ptid.
(exit_lwp): Pass target down to find_thread_ptid.
(attach_proc_task_lwp_callback): Pass target down to
add_thread/set_running/set_executing.
(linux_nat_target::attach): Pass target down to
thread_change_ptid.
(get_detach_signal): Pass target down to find_thread_ptid.
Consider last target status's target.
(linux_resume_one_lwp_throw, resume_lwp)
(linux_handle_syscall_trap, linux_handle_extended_wait, wait_lwp)
(stop_wait_callback, save_stop_reason, linux_nat_filter_event)
(linux_nat_wait_1, resume_stopped_resumed_lwps): Pass target down.
(linux_nat_target::async_wait_fd): New.
(linux_nat_stop_lwp, linux_nat_target::thread_address_space): Pass
target down.
* linux-nat.h (linux_nat_target::async_wait_fd): Declare.
* linux-tdep.c (get_thread_arch_regcache): Pass target down.
* linux-thread-db.c (struct thread_db_info::process_target): New
field.
(add_thread_db_info): Save target.
(get_thread_db_info): New process_stratum_target parameter. Also
match target.
(delete_thread_db_info): New process_stratum_target parameter.
Also match target.
(thread_from_lwp): Adjust to pass down target.
(thread_db_notice_clone): Pass down target.
(check_thread_db_callback): Pass down target.
(try_thread_db_load_1): Always push the thread_db target.
(try_thread_db_load, record_thread): Pass target down.
(thread_db_target::detach): Pass target down. Always unpush the
thread_db target.
(thread_db_target::wait, thread_db_target::mourn_inferior): Pass
target down. Always unpush the thread_db target.
(find_new_threads_callback, thread_db_find_new_threads_2)
(thread_db_target::update_thread_list): Pass target down.
(thread_db_target::pid_to_str): Pass current inferior down.
(thread_db_target::get_thread_local_address): Pass target down.
(thread_db_target::resume, maintenance_check_libthread_db): Pass
target down.
* nto-procfs.c (nto_procfs_target::update_thread_list): Adjust.
* procfs.c (procfs_target::procfs_init_inferior): Declare.
(proc_set_current_signal, do_attach, procfs_target::wait): Adjust.
(procfs_init_inferior): Rename to ...
(procfs_target::procfs_init_inferior): ... this and adjust.
(procfs_target::create_inferior, procfs_notice_thread)
(procfs_do_thread_registers): Adjust.
* ppc-fbsd-tdep.c: Include "inferior.h".
(ppcfbsd_get_thread_local_address): Pass down target.
* proc-service.c (ps_xfer_memory): Switch current inferior and
program space as well.
(get_ps_regcache): Pass target down.
* process-stratum-target.c
(process_stratum_target::thread_address_space)
(process_stratum_target::thread_architecture): Pass target down.
* process-stratum-target.h
(process_stratum_target::threads_executing): New field.
(as_process_stratum_target): New.
* ravenscar-thread.c
(ravenscar_thread_target::update_inferior_ptid): Pass target down.
(ravenscar_thread_target::wait, ravenscar_add_thread): Pass target
down.
* record-btrace.c (record_btrace_target::info_record): Adjust.
(record_btrace_target::record_method)
(record_btrace_target::record_is_replaying)
(record_btrace_target::fetch_registers)
(get_thread_current_frame_id, record_btrace_target::resume)
(record_btrace_target::wait, record_btrace_target::stop): Pass
target down.
* record-full.c (record_full_wait_1): Switch to event thread.
Pass target down.
* regcache.c (regcache::regcache)
(get_thread_arch_aspace_regcache, get_thread_arch_regcache): Add
process_stratum_target parameter and handle it.
(current_thread_target): New global.
(get_thread_regcache): Add process_stratum_target parameter and
handle it. Switch inferior before calling target method.
(get_thread_regcache): Pass target down.
(get_thread_regcache_for_ptid): Pass target down.
(registers_changed_ptid): Add process_stratum_target parameter and
handle it.
(registers_changed_thread, registers_changed): Pass target down.
(test_get_thread_arch_aspace_regcache): New.
(current_regcache_test): Define a couple local test_target_ops
instances and use them for testing.
(readwrite_regcache): Pass process_stratum_target parameter.
(cooked_read_test, cooked_write_test): Pass mock_target down.
* regcache.h (get_thread_regcache, get_thread_arch_regcache)
(get_thread_arch_aspace_regcache): Add process_stratum_target
parameter.
(regcache::target): New method.
(regcache::regcache, regcache::get_thread_arch_aspace_regcache)
(regcache::registers_changed_ptid): Add process_stratum_target
parameter.
(regcache::m_target): New field.
(registers_changed_ptid): Add process_stratum_target parameter.
* remote.c (remote_state::supports_vCont_probed): New field.
(remote_target::async_wait_fd): New method.
(remote_unpush_and_throw): Add remote_target parameter.
(get_current_remote_target): Adjust.
(remote_target::remote_add_inferior): Push target.
(remote_target::remote_add_thread)
(remote_target::remote_notice_new_inferior)
(get_remote_thread_info): Pass target down.
(remote_target::update_thread_list): Skip threads of inferiors
bound to other targets. (remote_target::close): Don't discard
inferiors. (remote_target::add_current_inferior_and_thread)
(remote_target::process_initial_stop_replies)
(remote_target::start_remote)
(remote_target::remote_serial_quit_handler): Pass down target.
(remote_target::remote_unpush_target): New remote_target
parameter. Unpush the target from all inferiors.
(remote_target::remote_unpush_and_throw): New remote_target
parameter. Pass it down.
(remote_target::open_1): Check whether the current inferior has
execution instead of checking whether any inferior is live. Pass
target down.
(remote_target::remote_detach_1): Pass down target. Use
remote_unpush_target.
(extended_remote_target::attach): Pass down target.
(remote_target::remote_vcont_probe): Set supports_vCont_probed.
(remote_target::append_resumption): Pass down target.
(remote_target::append_pending_thread_resumptions)
(remote_target::remote_resume_with_hc, remote_target::resume)
(remote_target::commit_resume): Pass down target.
(remote_target::remote_stop_ns): Check supports_vCont_probed.
(remote_target::interrupt_query)
(remote_target::remove_new_fork_children)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::remote_parse_stop_reply)
(remote_target::process_stop_reply): Pass down target.
(first_remote_resumed_thread): New remote_target parameter. Pass
it down.
(remote_target::wait_as): Pass down target.
(unpush_and_perror): New remote_target parameter. Pass it down.
(remote_target::readchar, remote_target::remote_serial_write)
(remote_target::getpkt_or_notif_sane_1)
(remote_target::kill_new_fork_children, remote_target::kill): Pass
down target.
(remote_target::mourn_inferior): Pass down target. Use
remote_unpush_target.
(remote_target::core_of_thread)
(remote_target::remote_btrace_maybe_reopen): Pass down target.
(remote_target::pid_to_exec_file)
(remote_target::thread_handle_to_thread_info): Pass down target.
(remote_target::async_wait_fd): New.
* riscv-fbsd-tdep.c: Include "inferior.h".
(riscv_fbsd_get_thread_local_address): Pass down target.
* sol2-tdep.c (sol2_core_pid_to_str): Pass down target.
* sol-thread.c (sol_thread_target::wait, ps_lgetregs, ps_lsetregs)
(ps_lgetfpregs, ps_lsetfpregs, sol_update_thread_list_callback):
Adjust.
* solib-spu.c (spu_skip_standalone_loader): Pass down target.
* solib-svr4.c (enable_break): Pass down target.
* spu-multiarch.c (parse_spufs_run): Pass down target.
* spu-tdep.c (spu2ppu_sniffer): Pass down target.
* target-delegates.c: Regenerate.
* target.c (g_target_stack): Delete.
(current_top_target): Return the current inferior's top target.
(target_has_execution_1): Refer to the passed-in inferior's top
target.
(target_supports_terminal_ours): Check whether the initial
inferior was already created.
(decref_target): New.
(target_stack::push): Incref/decref the target.
(push_target, push_target, unpush_target): Adjust.
(target_stack::unpush): Defref target.
(target_is_pushed): Return bool. Adjust to refer to the current
inferior's target stack.
(dispose_inferior): Delete, and inline parts ...
(target_preopen): ... here. Only dispose of the current inferior.
(target_detach): Hold strong target reference while detaching.
Pass target down.
(target_thread_name): Add assertion.
(target_resume): Pass down target.
(target_ops::beneath, find_target_at): Adjust to refer to the
current inferior's target stack.
(get_dummy_target): New.
(target_pass_ctrlc): Pass the Ctrl-C to the first inferior that
has a thread running.
(initialize_targets): Rename to ...
(_initialize_target): ... this.
* target.h: Include "gdbsupport/refcounted-object.h".
(struct target_ops): Inherit refcounted_object.
(target_ops::shortname, target_ops::longname): Make const.
(target_ops::async_wait_fd): New method.
(decref_target): Declare.
(struct target_ops_ref_policy): New.
(target_ops_ref): New typedef.
(get_dummy_target): Declare function.
(target_is_pushed): Return bool.
* thread-iter.c (all_matching_threads_iterator::m_inf_matches)
(all_matching_threads_iterator::all_matching_threads_iterator):
Handle filter target.
* thread-iter.h (struct all_matching_threads_iterator, struct
all_matching_threads_range, class all_non_exited_threads_range):
Filter by target too. Remove explicit.
* thread.c (threads_executing): Delete.
(inferior_thread): Pass down current inferior.
(clear_thread_inferior_resources): Pass down thread pointer
instead of ptid_t.
(add_thread_silent, add_thread_with_info, add_thread): Add
process_stratum_target parameter. Use it for thread and inferior
searches.
(is_current_thread): New.
(thread_info::deletable): Use it.
(find_thread_ptid, thread_count, in_thread_list)
(thread_change_ptid, set_resumed, set_running): New
process_stratum_target parameter. Pass it down.
(set_executing): New process_stratum_target parameter. Pass it
down. Adjust reference to 'threads_executing'.
(threads_are_executing): New process_stratum_target parameter.
Adjust reference to 'threads_executing'.
(set_stop_requested, finish_thread_state): New
process_stratum_target parameter. Pass it down.
(switch_to_thread): Also match inferior.
(switch_to_thread): New process_stratum_target parameter. Pass it
down.
(update_threads_executing): Reimplement.
* top.c (quit_force): Pop targets from all inferior.
(gdb_init): Don't call initialize_targets.
* windows-nat.c (windows_nat_target) <get_windows_debug_event>:
Declare.
(windows_add_thread, windows_delete_thread): Adjust.
(get_windows_debug_event): Rename to ...
(windows_nat_target::get_windows_debug_event): ... this. Adjust.
* tracefile-tfile.c (tfile_target_open): Pass down target.
* gdbsupport/common-gdbthread.h (struct process_stratum_target):
Forward declare.
(switch_to_thread): Add process_stratum_target parameter.
* mi/mi-interp.c (mi_on_resume_1): Add process_stratum_target
parameter. Use it.
(mi_on_resume): Pass target down.
* nat/fork-inferior.c (startup_inferior): Add
process_stratum_target parameter. Pass it down.
* nat/fork-inferior.h (startup_inferior): Add
process_stratum_target parameter.
* python/py-threadevent.c (py_get_event_thread): Pass target down.
gdb/gdbserver/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* fork-child.c (post_fork_inferior): Pass target down to
startup_inferior.
* inferiors.c (switch_to_thread): Add process_stratum_target
parameter.
* lynx-low.c (lynx_target_ops): Now a process_stratum_target.
* nto-low.c (nto_target_ops): Now a process_stratum_target.
* linux-low.c (linux_target_ops): Now a process_stratum_target.
* remote-utils.c (prepare_resume_reply): Pass the target to
switch_to_thread.
* target.c (the_target): Now a process_stratum_target.
(done_accessing_memory): Pass the target to switch_to_thread.
(set_target_ops): Ajust to use process_stratum_target.
* target.h (struct target_ops): Rename to ...
(struct process_stratum_target): ... this.
(the_target, set_target_ops): Adjust.
(prepare_to_access_memory): Adjust comment.
* win32-low.c (child_xfer_memory): Adjust to use
process_stratum_target.
(win32_target_ops): Now a process_stratum_target.
2020-01-10 21:06:08 +01:00
|
|
|
switch_to_thread (current_inferior ()->process_target (),
|
|
|
|
record_full_resume_ptid);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
struct regcache *regcache = get_current_regcache ();
|
2017-10-25 17:37:03 +02:00
|
|
|
struct gdbarch *gdbarch = regcache->arch ();
|
2017-11-02 16:15:42 +01:00
|
|
|
const struct address_space *aspace = regcache->aspace ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
int continue_flag = 1;
|
2013-03-11 09:44:14 +01:00
|
|
|
int first_record_full_end = 1;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2019-04-04 00:02:42 +02:00
|
|
|
try
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
CORE_ADDR tmp_pc;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
record_full_stop_reason = TARGET_STOPPED_BY_NO_REASON;
|
|
|
|
status->kind = TARGET_WAITKIND_STOPPED;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Check breakpoint when forward execute. */
|
|
|
|
if (execution_direction == EXEC_FORWARD)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
tmp_pc = regcache_read_pc (regcache);
|
|
|
|
if (record_check_stopped_by_breakpoint (aspace, tmp_pc,
|
|
|
|
&record_full_stop_reason))
|
|
|
|
{
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: break at %s.\n",
|
|
|
|
paddress (gdbarch, tmp_pc));
|
|
|
|
goto replay_out;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* If GDB is in terminal_inferior mode, it will not get the
|
|
|
|
signal. And in GDB replay mode, GDB doesn't need to be
|
|
|
|
in terminal_inferior mode, because inferior will not
|
|
|
|
executed. Then set it to terminal_ours to make GDB get
|
|
|
|
the signal. */
|
|
|
|
target_terminal::ours ();
|
|
|
|
|
|
|
|
/* In EXEC_FORWARD mode, record_full_list points to the tail of prev
|
|
|
|
instruction. */
|
|
|
|
if (execution_direction == EXEC_FORWARD && record_full_list->next)
|
|
|
|
record_full_list = record_full_list->next;
|
|
|
|
|
|
|
|
/* Loop over the record_full_list, looking for the next place to
|
|
|
|
stop. */
|
|
|
|
do
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Check for beginning and end of log. */
|
|
|
|
if (execution_direction == EXEC_REVERSE
|
|
|
|
&& record_full_list == &record_full_first)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Hit beginning of record log in reverse. */
|
|
|
|
status->kind = TARGET_WAITKIND_NO_HISTORY;
|
|
|
|
break;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2018-06-07 23:56:37 +02:00
|
|
|
if (execution_direction != EXEC_REVERSE
|
|
|
|
&& !record_full_list->next)
|
|
|
|
{
|
|
|
|
/* Hit end of record log going forward. */
|
|
|
|
status->kind = TARGET_WAITKIND_NO_HISTORY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
record_full_exec_insn (regcache, gdbarch, record_full_list);
|
|
|
|
|
|
|
|
if (record_full_list->type == record_full_end)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered
|
|
|
|
(gdb_stdlog,
|
|
|
|
"Process record: record_full_end %s to "
|
|
|
|
"inferior.\n",
|
|
|
|
host_address_to_string (record_full_list));
|
|
|
|
|
|
|
|
if (first_record_full_end
|
|
|
|
&& execution_direction == EXEC_REVERSE)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2019-10-18 02:48:08 +02:00
|
|
|
/* When reverse execute, the first
|
2018-06-07 23:56:37 +02:00
|
|
|
record_full_end is the part of current
|
|
|
|
instruction. */
|
|
|
|
first_record_full_end = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2018-06-07 23:56:37 +02:00
|
|
|
else
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
/* In EXEC_REVERSE mode, this is the
|
|
|
|
record_full_end of prev instruction. In
|
|
|
|
EXEC_FORWARD mode, this is the
|
|
|
|
record_full_end of current instruction. */
|
|
|
|
/* step */
|
|
|
|
if (record_full_resume_step)
|
|
|
|
{
|
|
|
|
if (record_debug > 1)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: step.\n");
|
|
|
|
continue_flag = 0;
|
|
|
|
}
|
2015-03-04 21:41:15 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* check breakpoint */
|
|
|
|
tmp_pc = regcache_read_pc (regcache);
|
|
|
|
if (record_check_stopped_by_breakpoint
|
|
|
|
(aspace, tmp_pc, &record_full_stop_reason))
|
|
|
|
{
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: break "
|
|
|
|
"at %s.\n",
|
|
|
|
paddress (gdbarch, tmp_pc));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
continue_flag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (record_full_stop_reason
|
|
|
|
== TARGET_STOPPED_BY_WATCHPOINT)
|
|
|
|
{
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: hit hw "
|
|
|
|
"watchpoint.\n");
|
|
|
|
continue_flag = 0;
|
|
|
|
}
|
|
|
|
/* Check target signal */
|
|
|
|
if (record_full_list->u.end.sigval != GDB_SIGNAL_0)
|
|
|
|
/* FIXME: better way to check */
|
|
|
|
continue_flag = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
if (continue_flag)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
if (execution_direction == EXEC_REVERSE)
|
|
|
|
{
|
|
|
|
if (record_full_list->prev)
|
|
|
|
record_full_list = record_full_list->prev;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (record_full_list->next)
|
|
|
|
record_full_list = record_full_list->next;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
2018-06-07 23:56:37 +02:00
|
|
|
while (continue_flag);
|
|
|
|
|
|
|
|
replay_out:
|
|
|
|
if (record_full_get_sig)
|
|
|
|
status->value.sig = GDB_SIGNAL_INT;
|
|
|
|
else if (record_full_list->u.end.sigval != GDB_SIGNAL_0)
|
|
|
|
/* FIXME: better way to check */
|
|
|
|
status->value.sig = record_full_list->u.end.sigval;
|
|
|
|
else
|
|
|
|
status->value.sig = GDB_SIGNAL_TRAP;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2019-04-03 23:59:07 +02:00
|
|
|
catch (const gdb_exception &ex)
|
2018-06-07 23:56:37 +02:00
|
|
|
{
|
|
|
|
if (execution_direction == EXEC_REVERSE)
|
|
|
|
{
|
|
|
|
if (record_full_list->next)
|
|
|
|
record_full_list = record_full_list->next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
record_full_list = record_full_list->prev;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Replace throw_exception with throw in some cases
This replaces throw_exception with "throw;" when possible. This was
written by script. The rule that is followed is that uses of the
form:
catch (... &name)
{
...
throw_exception (name);
}
... can be rewritten. This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.
2019-01-28 18:45:45 +01:00
|
|
|
throw;
|
2018-06-07 23:56:37 +02:00
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
signal (SIGINT, handle_sigint);
|
|
|
|
|
|
|
|
return inferior_ptid;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
ptid_t
|
|
|
|
record_full_base_target::wait (ptid_t ptid, struct target_waitstatus *status,
|
|
|
|
int options)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
ptid_t return_ptid;
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
return_ptid = record_full_wait_1 (this, ptid, status, options);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (status->kind != TARGET_WAITKIND_IGNORE)
|
|
|
|
{
|
|
|
|
/* We're reporting a stop. Make sure any spurious
|
|
|
|
target_wait(WNOHANG) doesn't advance the target until the
|
|
|
|
core wants us resumed again. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_resumed = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
return return_ptid;
|
|
|
|
}
|
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::stopped_by_watchpoint ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
2015-03-04 21:41:15 +01:00
|
|
|
return record_full_stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2018-06-07 18:27:47 +02:00
|
|
|
return beneath ()->stopped_by_watchpoint ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::stopped_data_address (CORE_ADDR *addr_p)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
return false;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2018-06-07 18:27:47 +02:00
|
|
|
return this->beneath ()->stopped_data_address (addr_p);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The stopped_by_sw_breakpoint method of target record-full. */
|
2015-03-04 21:41:15 +01:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::stopped_by_sw_breakpoint ()
|
2015-03-04 21:41:15 +01:00
|
|
|
{
|
|
|
|
return record_full_stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The supports_stopped_by_sw_breakpoint method of target
|
2015-03-04 21:41:15 +01:00
|
|
|
record-full. */
|
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::supports_stopped_by_sw_breakpoint ()
|
2015-03-04 21:41:15 +01:00
|
|
|
{
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
return true;
|
2015-03-04 21:41:15 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The stopped_by_hw_breakpoint method of target record-full. */
|
2015-03-04 21:41:15 +01:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::stopped_by_hw_breakpoint ()
|
2015-03-04 21:41:15 +01:00
|
|
|
{
|
|
|
|
return record_full_stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The supports_stopped_by_sw_breakpoint method of target
|
2015-03-04 21:41:15 +01:00
|
|
|
record-full. */
|
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::supports_stopped_by_hw_breakpoint ()
|
2015-03-04 21:41:15 +01:00
|
|
|
{
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
return true;
|
2015-03-04 21:41:15 +01:00
|
|
|
}
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Record registers change (by user or by GDB) to list as an instruction. */
|
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_registers_change (struct regcache *regcache, int regnum)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Check record_full_insn_num. */
|
2016-04-12 17:49:32 +02:00
|
|
|
record_full_check_insn_num ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_head = NULL;
|
|
|
|
record_full_arch_list_tail = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (regnum < 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2017-10-25 17:37:03 +02:00
|
|
|
for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:45:54 +01:00
|
|
|
if (record_full_arch_list_add_reg (regcache, i))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("Process record: failed to record execution log."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-11 09:45:54 +01:00
|
|
|
if (record_full_arch_list_add_reg (regcache, regnum))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("Process record: failed to record execution log."));
|
|
|
|
}
|
|
|
|
}
|
2013-03-11 09:45:54 +01:00
|
|
|
if (record_full_arch_list_add_end ())
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("Process record: failed to record execution log."));
|
|
|
|
}
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->next = record_full_arch_list_head;
|
|
|
|
record_full_arch_list_head->prev = record_full_list;
|
|
|
|
record_full_list = record_full_arch_list_tail;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
if (record_full_insn_num == record_full_insn_max_num)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_first ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num++;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "store_registers" method for process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_target::store_registers (struct regcache *regcache, int regno)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!record_full_gdb_operation_disable)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
/* Let user choose if he wants to write register or not. */
|
|
|
|
if (regno < 0)
|
|
|
|
n =
|
|
|
|
query (_("Because GDB is in replay mode, changing the "
|
|
|
|
"value of a register will make the execution "
|
|
|
|
"log unusable from this point onward. "
|
|
|
|
"Change all registers?"));
|
|
|
|
else
|
|
|
|
n =
|
|
|
|
query (_("Because GDB is in replay mode, changing the value "
|
|
|
|
"of a register will make the execution log unusable "
|
|
|
|
"from this point onward. Change register %s?"),
|
2017-10-25 17:37:03 +02:00
|
|
|
gdbarch_register_name (regcache->arch (),
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
regno));
|
|
|
|
|
|
|
|
if (!n)
|
|
|
|
{
|
|
|
|
/* Invalidate the value of regcache that was set in function
|
|
|
|
"regcache_raw_write". */
|
|
|
|
if (regno < 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0;
|
2017-10-25 17:37:03 +02:00
|
|
|
i < gdbarch_num_regs (regcache->arch ());
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
i++)
|
2018-05-30 20:54:41 +02:00
|
|
|
regcache->invalidate (i);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
2018-05-30 20:54:41 +02:00
|
|
|
regcache->invalidate (regno);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
error (_("Process record canceled the operation."));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Destroy the record from here forward. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_following (record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_registers_change (regcache, regno);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2018-06-07 18:27:47 +02:00
|
|
|
this->beneath ()->store_registers (regcache, regno);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "xfer_partial" method. Behavior is conditional on
|
2013-03-11 09:44:14 +01:00
|
|
|
RECORD_FULL_IS_REPLAY.
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
In replay mode, we cannot write memory unles we are willing to
|
|
|
|
invalidate the record/replay log from this point forward. */
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
enum target_xfer_status
|
|
|
|
record_full_target::xfer_partial (enum target_object object,
|
|
|
|
const char *annex, gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf, ULONGEST offset,
|
|
|
|
ULONGEST len, ULONGEST *xfered_len)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!record_full_gdb_operation_disable
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
&& (object == TARGET_OBJECT_MEMORY
|
|
|
|
|| object == TARGET_OBJECT_RAW_MEMORY) && writebuf)
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* Let user choose if he wants to write memory or not. */
|
|
|
|
if (!query (_("Because GDB is in replay mode, writing to memory "
|
|
|
|
"will make the execution log unusable from this "
|
|
|
|
"point onward. Write memory at address %s?"),
|
|
|
|
paddress (target_gdbarch (), offset)))
|
|
|
|
error (_("Process record canceled the operation."));
|
|
|
|
|
|
|
|
/* Destroy the record from here forward. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_following (record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Check record_full_insn_num */
|
2016-04-12 17:49:32 +02:00
|
|
|
record_full_check_insn_num ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Record registers change to list as an instruction. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_arch_list_head = NULL;
|
|
|
|
record_full_arch_list_tail = NULL;
|
2013-03-11 09:45:54 +01:00
|
|
|
if (record_full_arch_list_add_mem (offset, len))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: failed to record "
|
|
|
|
"execution log.");
|
2014-01-27 10:32:33 +01:00
|
|
|
return TARGET_XFER_E_IO;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2013-03-11 09:45:54 +01:00
|
|
|
if (record_full_arch_list_add_end ())
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
"Process record: failed to record "
|
|
|
|
"execution log.");
|
2014-01-27 10:32:33 +01:00
|
|
|
return TARGET_XFER_E_IO;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->next = record_full_arch_list_head;
|
|
|
|
record_full_arch_list_head->prev = record_full_list;
|
|
|
|
record_full_list = record_full_arch_list_tail;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
if (record_full_insn_num == record_full_insn_max_num)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_first ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num++;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
|
|
|
|
offset, len, xfered_len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This structure represents a breakpoint inserted while the record
|
|
|
|
target is active. We use this to know when to install/remove
|
|
|
|
breakpoints in/from the target beneath. For example, a breakpoint
|
|
|
|
may be inserted while recording, but removed when not replaying nor
|
|
|
|
recording. In that case, the breakpoint had not been inserted on
|
|
|
|
the target beneath, so we should not try to remove it there. */
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_breakpoint
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
record_full_breakpoint (struct address_space *address_space_,
|
|
|
|
CORE_ADDR addr_,
|
|
|
|
bool in_target_beneath_)
|
|
|
|
: address_space (address_space_),
|
|
|
|
addr (addr_),
|
|
|
|
in_target_beneath (in_target_beneath_)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* The address and address space the breakpoint was set at. */
|
|
|
|
struct address_space *address_space;
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
|
|
|
/* True when the breakpoint has been also installed in the target
|
|
|
|
beneath. This will be false for breakpoints set during replay or
|
|
|
|
when recording. */
|
2018-06-08 01:22:49 +02:00
|
|
|
bool in_target_beneath;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The list of breakpoints inserted while the record target is
|
|
|
|
active. */
|
2018-06-08 01:22:49 +02:00
|
|
|
static std::vector<record_full_breakpoint> record_full_breakpoints;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_sync_record_breakpoints (struct bp_location *loc, void *data)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (loc->loc_type != bp_loc_software_breakpoint)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (loc->inserted)
|
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
record_full_breakpoints.emplace_back
|
|
|
|
(loc->target_info.placed_address_space,
|
|
|
|
loc->target_info.placed_address,
|
|
|
|
1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Sync existing breakpoints to record_full_breakpoints. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_init_record_breakpoints (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
record_full_breakpoints.clear ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
iterate_over_bp_locations (record_full_sync_record_breakpoints);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Behavior is conditional on RECORD_FULL_IS_REPLAY. We will not actually
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
insert or remove breakpoints in the real target when replaying, nor
|
|
|
|
when recording. */
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
int
|
|
|
|
record_full_target::insert_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
struct bp_target_info *bp_tgt)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
bool in_target_beneath = false;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (!RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* When recording, we currently always single-step, so we don't
|
|
|
|
really need to install regular breakpoints in the inferior.
|
|
|
|
However, we do have to insert software single-step
|
|
|
|
breakpoints, in case the target can't hardware step. To keep
|
2016-08-31 15:28:27 +02:00
|
|
|
things simple, we always insert. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore restore_operation_disable
|
|
|
|
= record_full_gdb_operation_disable_set ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
int ret = this->beneath ()->insert_breakpoint (gdbarch, bp_tgt);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (ret != 0)
|
|
|
|
return ret;
|
|
|
|
|
2018-06-08 01:22:49 +02:00
|
|
|
in_target_beneath = true;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Make breakpoint handling in record-full idempotent
Some test fails in gdb.reverse/break-reverse.exp on arm-linux lead me
seeing the following error message,
continue^M
Continuing.^M
Cannot remove breakpoints because program is no longer writable.^M
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Further execution is probably impossible.^M
^M
Breakpoint 3, bar () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/break-reverse.c:22^M
22 xyz = 2; /* break in bar */^M
(gdb) PASS: gdb.reverse/break-reverse.exp: continue to breakpoint: bar backward
this is caused by two entries in record_full_breakpoints, and their addr
is the same, but in_target_beneath is different.
during the record, we do continue,
Continuing.
infrun: clear_proceed_status_thread (Thread 13772.13772)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13772.13772] for step-over
infrun: skipping breakpoint: stepping past insn at: 0x8620
Sending packet: $Z0,85f4,4#1d...Packet received: OK <----
.....
Sending packet: $vCont;c#a8...infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: T05swbreak:;0b:9cf5ffbe;0d:9cf5ffbe;0f:f4850000;thread:p35cc.35cc;core:1;
Sending packet: $Z0,85f4,4#1d...Packet received: OK <-----
....
Sending packet: $z0,85f4,4#3d...Packet received: OK <-----
we can see breakpoint on 0x85f4 are inserted *twice*, but only removed
once. That is fine to remote target, because Z/z packets are
idempotent, but there is a leftover in record_full_breakpoints
in record-full target. The flow can be described as below,
record_full_breakpoints remote target
-----------------------------------------------------------------------
forward execution, continue, in_target_beneath 1 breakpoint inserted
insert breakpoints on 0x85f4 in_target_beneath 1
twice
program stops,
remove breakpoint on 0x85f4 in_target_beneath 1 breakpoint removed
reverse execution, continue, in_target_beneath 1 none is requested
insert breakpoints on 0x85f4, in_target_beneath 0
program stops,
remote breakpoint on 0x85f4, in_target_beneath 0 request to remove,
but GDBserver
doesn't know
now, the question is why breakoint on 0x85f4 is inserted twice? One
is the normal breakpoint, and the other is the single step breakpoint.
GDB inserts single step breakpoint to do single step. When program
stops at 0x85f4, both of them are set on 0x85f4, and GDB deletes
single step breakpoint, so in update_global_location_list, this
breakpoint location is no longer found, GDB call
force_breakpoint_reinsertion to mark it condition_updated, and insert
it again.
The reason force_breakpoint_reinsertion is called to update the
conditions in the target side, because the conditions may be
changed. My original fix is to not call force_breakpoint_reinsertion
if OLD_LOC->cond is NULL, but it is not correct if another location
on the same address has condition, GDB doesn't produce condition for
target side, but GDB should do.
Then, I change my mind back to make record-full handling breakpoint
idempotent, to align with remote target. Before insert a new entry
into record_full_breakpoints, look for existing one on the same
address first. I also add an assert on
"bp->in_target_beneath == in_target_beneath", to be safer.
gdb:
2016-04-07 Yao Qi <yao.qi@linaro.org>
* record-full.c (record_full_insert_breakpoint): Return
early if entry on the address is found in
record_full_breakpoints.
2016-04-07 17:47:26 +02:00
|
|
|
/* Use the existing entries if found in order to avoid duplication
|
|
|
|
in record_full_breakpoints. */
|
|
|
|
|
2018-06-20 18:40:54 +02:00
|
|
|
for (const record_full_breakpoint &bp : record_full_breakpoints)
|
Make breakpoint handling in record-full idempotent
Some test fails in gdb.reverse/break-reverse.exp on arm-linux lead me
seeing the following error message,
continue^M
Continuing.^M
Cannot remove breakpoints because program is no longer writable.^M
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Further execution is probably impossible.^M
^M
Breakpoint 3, bar () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/break-reverse.c:22^M
22 xyz = 2; /* break in bar */^M
(gdb) PASS: gdb.reverse/break-reverse.exp: continue to breakpoint: bar backward
this is caused by two entries in record_full_breakpoints, and their addr
is the same, but in_target_beneath is different.
during the record, we do continue,
Continuing.
infrun: clear_proceed_status_thread (Thread 13772.13772)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13772.13772] for step-over
infrun: skipping breakpoint: stepping past insn at: 0x8620
Sending packet: $Z0,85f4,4#1d...Packet received: OK <----
.....
Sending packet: $vCont;c#a8...infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: T05swbreak:;0b:9cf5ffbe;0d:9cf5ffbe;0f:f4850000;thread:p35cc.35cc;core:1;
Sending packet: $Z0,85f4,4#1d...Packet received: OK <-----
....
Sending packet: $z0,85f4,4#3d...Packet received: OK <-----
we can see breakpoint on 0x85f4 are inserted *twice*, but only removed
once. That is fine to remote target, because Z/z packets are
idempotent, but there is a leftover in record_full_breakpoints
in record-full target. The flow can be described as below,
record_full_breakpoints remote target
-----------------------------------------------------------------------
forward execution, continue, in_target_beneath 1 breakpoint inserted
insert breakpoints on 0x85f4 in_target_beneath 1
twice
program stops,
remove breakpoint on 0x85f4 in_target_beneath 1 breakpoint removed
reverse execution, continue, in_target_beneath 1 none is requested
insert breakpoints on 0x85f4, in_target_beneath 0
program stops,
remote breakpoint on 0x85f4, in_target_beneath 0 request to remove,
but GDBserver
doesn't know
now, the question is why breakoint on 0x85f4 is inserted twice? One
is the normal breakpoint, and the other is the single step breakpoint.
GDB inserts single step breakpoint to do single step. When program
stops at 0x85f4, both of them are set on 0x85f4, and GDB deletes
single step breakpoint, so in update_global_location_list, this
breakpoint location is no longer found, GDB call
force_breakpoint_reinsertion to mark it condition_updated, and insert
it again.
The reason force_breakpoint_reinsertion is called to update the
conditions in the target side, because the conditions may be
changed. My original fix is to not call force_breakpoint_reinsertion
if OLD_LOC->cond is NULL, but it is not correct if another location
on the same address has condition, GDB doesn't produce condition for
target side, but GDB should do.
Then, I change my mind back to make record-full handling breakpoint
idempotent, to align with remote target. Before insert a new entry
into record_full_breakpoints, look for existing one on the same
address first. I also add an assert on
"bp->in_target_beneath == in_target_beneath", to be safer.
gdb:
2016-04-07 Yao Qi <yao.qi@linaro.org>
* record-full.c (record_full_insert_breakpoint): Return
early if entry on the address is found in
record_full_breakpoints.
2016-04-07 17:47:26 +02:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
if (bp.addr == bp_tgt->placed_address
|
|
|
|
&& bp.address_space == bp_tgt->placed_address_space)
|
Make breakpoint handling in record-full idempotent
Some test fails in gdb.reverse/break-reverse.exp on arm-linux lead me
seeing the following error message,
continue^M
Continuing.^M
Cannot remove breakpoints because program is no longer writable.^M
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Further execution is probably impossible.^M
^M
Breakpoint 3, bar () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/break-reverse.c:22^M
22 xyz = 2; /* break in bar */^M
(gdb) PASS: gdb.reverse/break-reverse.exp: continue to breakpoint: bar backward
this is caused by two entries in record_full_breakpoints, and their addr
is the same, but in_target_beneath is different.
during the record, we do continue,
Continuing.
infrun: clear_proceed_status_thread (Thread 13772.13772)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13772.13772] for step-over
infrun: skipping breakpoint: stepping past insn at: 0x8620
Sending packet: $Z0,85f4,4#1d...Packet received: OK <----
.....
Sending packet: $vCont;c#a8...infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: T05swbreak:;0b:9cf5ffbe;0d:9cf5ffbe;0f:f4850000;thread:p35cc.35cc;core:1;
Sending packet: $Z0,85f4,4#1d...Packet received: OK <-----
....
Sending packet: $z0,85f4,4#3d...Packet received: OK <-----
we can see breakpoint on 0x85f4 are inserted *twice*, but only removed
once. That is fine to remote target, because Z/z packets are
idempotent, but there is a leftover in record_full_breakpoints
in record-full target. The flow can be described as below,
record_full_breakpoints remote target
-----------------------------------------------------------------------
forward execution, continue, in_target_beneath 1 breakpoint inserted
insert breakpoints on 0x85f4 in_target_beneath 1
twice
program stops,
remove breakpoint on 0x85f4 in_target_beneath 1 breakpoint removed
reverse execution, continue, in_target_beneath 1 none is requested
insert breakpoints on 0x85f4, in_target_beneath 0
program stops,
remote breakpoint on 0x85f4, in_target_beneath 0 request to remove,
but GDBserver
doesn't know
now, the question is why breakoint on 0x85f4 is inserted twice? One
is the normal breakpoint, and the other is the single step breakpoint.
GDB inserts single step breakpoint to do single step. When program
stops at 0x85f4, both of them are set on 0x85f4, and GDB deletes
single step breakpoint, so in update_global_location_list, this
breakpoint location is no longer found, GDB call
force_breakpoint_reinsertion to mark it condition_updated, and insert
it again.
The reason force_breakpoint_reinsertion is called to update the
conditions in the target side, because the conditions may be
changed. My original fix is to not call force_breakpoint_reinsertion
if OLD_LOC->cond is NULL, but it is not correct if another location
on the same address has condition, GDB doesn't produce condition for
target side, but GDB should do.
Then, I change my mind back to make record-full handling breakpoint
idempotent, to align with remote target. Before insert a new entry
into record_full_breakpoints, look for existing one on the same
address first. I also add an assert on
"bp->in_target_beneath == in_target_beneath", to be safer.
gdb:
2016-04-07 Yao Qi <yao.qi@linaro.org>
* record-full.c (record_full_insert_breakpoint): Return
early if entry on the address is found in
record_full_breakpoints.
2016-04-07 17:47:26 +02:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
gdb_assert (bp.in_target_beneath == in_target_beneath);
|
Make breakpoint handling in record-full idempotent
Some test fails in gdb.reverse/break-reverse.exp on arm-linux lead me
seeing the following error message,
continue^M
Continuing.^M
Cannot remove breakpoints because program is no longer writable.^M
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Further execution is probably impossible.^M
^M
Breakpoint 3, bar () at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.reverse/break-reverse.c:22^M
22 xyz = 2; /* break in bar */^M
(gdb) PASS: gdb.reverse/break-reverse.exp: continue to breakpoint: bar backward
this is caused by two entries in record_full_breakpoints, and their addr
is the same, but in_target_beneath is different.
during the record, we do continue,
Continuing.
infrun: clear_proceed_status_thread (Thread 13772.13772)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [Thread 13772.13772] for step-over
infrun: skipping breakpoint: stepping past insn at: 0x8620
Sending packet: $Z0,85f4,4#1d...Packet received: OK <----
.....
Sending packet: $vCont;c#a8...infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun: -1.0.0 [process -1],
infrun: status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: T05swbreak:;0b:9cf5ffbe;0d:9cf5ffbe;0f:f4850000;thread:p35cc.35cc;core:1;
Sending packet: $Z0,85f4,4#1d...Packet received: OK <-----
....
Sending packet: $z0,85f4,4#3d...Packet received: OK <-----
we can see breakpoint on 0x85f4 are inserted *twice*, but only removed
once. That is fine to remote target, because Z/z packets are
idempotent, but there is a leftover in record_full_breakpoints
in record-full target. The flow can be described as below,
record_full_breakpoints remote target
-----------------------------------------------------------------------
forward execution, continue, in_target_beneath 1 breakpoint inserted
insert breakpoints on 0x85f4 in_target_beneath 1
twice
program stops,
remove breakpoint on 0x85f4 in_target_beneath 1 breakpoint removed
reverse execution, continue, in_target_beneath 1 none is requested
insert breakpoints on 0x85f4, in_target_beneath 0
program stops,
remote breakpoint on 0x85f4, in_target_beneath 0 request to remove,
but GDBserver
doesn't know
now, the question is why breakoint on 0x85f4 is inserted twice? One
is the normal breakpoint, and the other is the single step breakpoint.
GDB inserts single step breakpoint to do single step. When program
stops at 0x85f4, both of them are set on 0x85f4, and GDB deletes
single step breakpoint, so in update_global_location_list, this
breakpoint location is no longer found, GDB call
force_breakpoint_reinsertion to mark it condition_updated, and insert
it again.
The reason force_breakpoint_reinsertion is called to update the
conditions in the target side, because the conditions may be
changed. My original fix is to not call force_breakpoint_reinsertion
if OLD_LOC->cond is NULL, but it is not correct if another location
on the same address has condition, GDB doesn't produce condition for
target side, but GDB should do.
Then, I change my mind back to make record-full handling breakpoint
idempotent, to align with remote target. Before insert a new entry
into record_full_breakpoints, look for existing one on the same
address first. I also add an assert on
"bp->in_target_beneath == in_target_beneath", to be safer.
gdb:
2016-04-07 Yao Qi <yao.qi@linaro.org>
* record-full.c (record_full_insert_breakpoint): Return
early if entry on the address is found in
record_full_breakpoints.
2016-04-07 17:47:26 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-08 01:22:49 +02:00
|
|
|
record_full_breakpoints.emplace_back (bp_tgt->placed_address_space,
|
|
|
|
bp_tgt->placed_address,
|
|
|
|
in_target_beneath);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "remove_breakpoint" method for process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
int
|
|
|
|
record_full_target::remove_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
struct bp_target_info *bp_tgt,
|
|
|
|
enum remove_bp_reason reason)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
for (auto iter = record_full_breakpoints.begin ();
|
|
|
|
iter != record_full_breakpoints.end ();
|
|
|
|
++iter)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
struct record_full_breakpoint &bp = *iter;
|
|
|
|
|
|
|
|
if (bp.addr == bp_tgt->placed_address
|
|
|
|
&& bp.address_space == bp_tgt->placed_address_space)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-08 01:22:49 +02:00
|
|
|
if (bp.in_target_beneath)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore restore_operation_disable
|
|
|
|
= record_full_gdb_operation_disable_set ();
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
int ret = this->beneath ()->remove_breakpoint (gdbarch, bp_tgt,
|
|
|
|
reason);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (ret != 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-08-11 00:03:29 +02:00
|
|
|
if (reason == REMOVE_BREAKPOINT)
|
2018-06-08 01:22:49 +02:00
|
|
|
unordered_remove (record_full_breakpoints, iter);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_assert_not_reached ("removing unknown breakpoint");
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "can_execute_reverse" method for process record target. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::can_execute_reverse ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
return true;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "get_bookmark" method for process record and prec over core. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
gdb_byte *
|
|
|
|
record_full_base_target::get_bookmark (const char *args, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-04-19 17:32:56 +02:00
|
|
|
char *ret = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Return stringified form of instruction count. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list && record_full_list->type == record_full_end)
|
|
|
|
ret = xstrdup (pulongest (record_full_list->u.end.insn_num));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug)
|
|
|
|
{
|
|
|
|
if (ret)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"record_full_get_bookmark returns %s\n", ret);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"record_full_get_bookmark returns NULL\n");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2013-04-19 17:32:56 +02:00
|
|
|
return (gdb_byte *) ret;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "goto_bookmark" method for process record and prec over core. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::goto_bookmark (const gdb_byte *raw_bookmark,
|
|
|
|
int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-04-15 16:59:03 +02:00
|
|
|
const char *bookmark = (const char *) raw_bookmark;
|
2013-04-19 17:32:56 +02:00
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
"record_full_goto_bookmark receives %s\n", bookmark);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-03-21 23:59:28 +01:00
|
|
|
std::string name_holder;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (bookmark[0] == '\'' || bookmark[0] == '\"')
|
|
|
|
{
|
|
|
|
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
|
|
|
|
error (_("Unbalanced quotes: %s"), bookmark);
|
|
|
|
|
2018-03-21 23:59:28 +01:00
|
|
|
name_holder = std::string (bookmark + 1, strlen (bookmark) - 2);
|
|
|
|
bookmark = name_holder.c_str ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2013-04-15 16:59:03 +02:00
|
|
|
record_goto (bookmark);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
enum exec_direction_kind
|
|
|
|
record_full_base_target::execution_direction ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
return record_full_execution_dir;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The record_method method of target record-full. */
|
2016-12-13 11:24:56 +01:00
|
|
|
|
|
|
|
enum record_method
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::record_method (ptid_t ptid)
|
2016-12-13 11:24:56 +01:00
|
|
|
{
|
|
|
|
return RECORD_METHOD_FULL;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::info_record ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *p;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
printf_filtered (_("Replay mode:\n"));
|
|
|
|
else
|
|
|
|
printf_filtered (_("Record mode:\n"));
|
|
|
|
|
|
|
|
/* Find entry for first actual instruction in the log. */
|
2013-03-11 09:44:14 +01:00
|
|
|
for (p = record_full_first.next;
|
|
|
|
p != NULL && p->type != record_full_end;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
p = p->next)
|
|
|
|
;
|
|
|
|
|
|
|
|
/* Do we have a log at all? */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (p != NULL && p->type == record_full_end)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
/* Display instruction number for first instruction in the log. */
|
|
|
|
printf_filtered (_("Lowest recorded instruction number is %s.\n"),
|
|
|
|
pulongest (p->u.end.insn_num));
|
|
|
|
|
|
|
|
/* If in replay mode, display where we are in the log. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (RECORD_FULL_IS_REPLAY)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
printf_filtered (_("Current instruction number is %s.\n"),
|
2013-03-11 09:44:14 +01:00
|
|
|
pulongest (record_full_list->u.end.insn_num));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Display instruction number for last instruction in the log. */
|
|
|
|
printf_filtered (_("Highest recorded instruction number is %s.\n"),
|
2013-03-11 09:44:14 +01:00
|
|
|
pulongest (record_full_insn_count));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Display log count. */
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
printf_filtered (_("Log contains %u instructions.\n"),
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_num);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printf_filtered (_("No instructions have been logged.\n"));
|
|
|
|
|
|
|
|
/* Display max log size. */
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
printf_filtered (_("Max logged instructions is %u.\n"),
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_max_num);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
bool
|
|
|
|
record_full_base_target::supports_delete_record ()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "delete_record" target method. */
|
|
|
|
|
|
|
|
void
|
|
|
|
record_full_base_target::delete_record ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_following (record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "record_is_replaying" target method. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::record_is_replaying (ptid_t ptid)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
return RECORD_FULL_IS_REPLAY;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "record_will_replay" target method. */
|
2015-09-17 11:14:55 +02:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_base_target::record_will_replay (ptid_t ptid, int dir)
|
2015-09-17 11:14:55 +02:00
|
|
|
{
|
|
|
|
/* We can currently only record when executing forwards. Should we be able
|
|
|
|
to record when executing backwards on targets that support reverse
|
|
|
|
execution, this needs to be changed. */
|
|
|
|
|
|
|
|
return RECORD_FULL_IS_REPLAY || dir == EXEC_REVERSE;
|
|
|
|
}
|
|
|
|
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
/* Go to a specific entry. */
|
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_entry (struct record_full_entry *p)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (p == NULL)
|
|
|
|
error (_("Target insn not found."));
|
2013-03-11 09:44:14 +01:00
|
|
|
else if (p == record_full_list)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("Already at target insn."));
|
2013-03-11 09:44:14 +01:00
|
|
|
else if (p->u.end.insn_num > record_full_list->u.end.insn_num)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
printf_filtered (_("Go forward to insn number %s\n"),
|
|
|
|
pulongest (p->u.end.insn_num));
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_insn (p, EXEC_FORWARD);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf_filtered (_("Go backward to insn number %s\n"),
|
|
|
|
pulongest (p->u.end.insn_num));
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_insn (p, EXEC_REVERSE);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
registers_changed ();
|
|
|
|
reinit_frame_cache ();
|
gdb: Eliminate the 'stop_pc' global
In my multi-target work, I need to add a few more
scoped_restore_current_thread and switch_to_thread calls in some
places, and in some lower-level places I was fighting against the fact
that switch_to_thread reads/refreshes the stop_pc global.
Instead of piling on workarounds, let's just finally eliminate the
stop_pc global. We already have the per-thread
thread_info->suspend.stop_pc field, so it's mainly a matter of using
that more/instead.
gdb/ChangeLog:
2018-06-28 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_suspend_state) <stop_pc>: Extend
comments.
(switch_to_thread_no_regs): Adjust comment.
* infcmd.c (stop_pc): Delete.
(post_create_inferior, info_program_command): Replace references
to stop_pc with references to thread_info->suspend.stop_pc.
* inferior.h (stop_pc): Delete declaration.
* infrun.c (proceed, handle_syscall_event, fill_in_stop_func)
(handle_inferior_event_1, handle_signal_stop)
(process_event_stop_test, keep_going_stepped_thread)
(handle_step_into_function, handle_step_into_function_backward)
(print_stop_location): Replace references to stop_pc with
references to thread_info->suspend.stop_pc.
(struct infcall_suspend_state) <stop_pc>: Delete field.
(save_infcall_suspend_state, restore_infcall_suspend_state):
Remove references to inf_stat->stop_pc.
* linux-fork.c (fork_load_infrun_state): Likewise.
* record-btrace.c (record_btrace_set_replay): Likewise.
* record-full.c (record_full_goto_entry): Likewise.
* remote.c (print_one_stopped_thread): Likewise.
* target.c (target_resume): Extend comment.
* thread.c (set_executing_thread): New.
(set_executing): Use it.
(switch_to_thread_no_regs, switch_to_no_thread, switch_to_thread):
Remove references to stop_pc.
2018-06-28 21:18:24 +02:00
|
|
|
inferior_thread ()->suspend.stop_pc
|
|
|
|
= regcache_read_pc (get_current_regcache ());
|
PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...
(gdb) b start
(gdb) c
...
(gdb) list
*lists "start"*
(gdb) b 23
Breakpoint 3 at 0x400614: file test.c, line 23.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
(gdb) b 23
Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
^^^^^^^^^^^^^^^
(gdb) list
93 lll_wait_tid (pd->tid);
94
95
96 /* Restore cancellation mode. */
97 CANCEL_RESET (oldtype);
98
99 /* Remove the handler. */
100 pthread_cleanup_pop (0);
101
102
The issue is that print_stack_frame always sets the current sal to the
frame's sal. print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION. Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO. What we have is two logically
distinct operations mixed in the same function(s):
#1 - print frame, in the format specified by {print_what,
print_level and print_args}.
#2 - We're displaying a frame to the user, and I want the default
sal to point here, because the program stopped here, or the user
did some context-changing command (up, down, etc.).
So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.
Tested on x86_64 Fedora 17.
gdb/
2013-09-17 Pedro Alves <palves@redhat.com>
PR gdb/15911
* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
* corelow.c (core_open):
* frame.h (print_stack_frame, print_frame_info): New
'set_current_sal' parameter.
* infcmd.c (finish_command, kill_command): Adjust call to
print_stack_frame.
* inferior.c (inferior_command): Likewise.
* infrun.c (normal_stop): Likewise.
* linux-fork.c (linux_fork_context): Likewise.
* record-full.c (record_full_goto_entry, record_full_restore):
Likewise.
* remote-mips.c (common_open): Likewise.
* stack.c (print_stack_frame): New 'set_current_sal' parameter.
Use it.
(print_frame_info): New 'set_current_sal' parameter. Set the last
displayed sal depending on the new paremeter instead of looking at
print_what.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust call to
print_stack_frame.
* thread.c (print_thread_info, restore_selected_frame)
(do_captured_thread_select): Adjust call to print_stack_frame.
* tracepoint.c (tfind_1): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Likewise.
* mi/mi-interp.c (mi_on_normal_stop): Likewise.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.
gdb/testsuite/
* gdb.threads/info-threads-cur-sal-2.c: New file.
* gdb.threads/info-threads-cur-sal.c: New file.
* gdb.threads/info-threads-cur-sal.exp: New file.
2013-09-17 20:26:41 +02:00
|
|
|
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "goto_record_begin" target method. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::goto_record_begin ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *p = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
for (p = &record_full_first; p != NULL; p = p->next)
|
|
|
|
if (p->type == record_full_end)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_entry (p);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "goto_record_end" target method. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::goto_record_end ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *p = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
for (p = record_full_list; p->next != NULL; p = p->next)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
;
|
|
|
|
for (; p!= NULL; p = p->prev)
|
2013-03-11 09:44:14 +01:00
|
|
|
if (p->type == record_full_end)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_entry (p);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "goto_record" target method. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::goto_record (ULONGEST target_insn)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *p = NULL;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
for (p = &record_full_first; p != NULL; p = p->next)
|
|
|
|
if (p->type == record_full_end && p->u.end.insn_num == target_insn)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_entry (p);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* The "record_stop_replaying" target method. */
|
2015-09-08 09:42:20 +02:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::record_stop_replaying ()
|
2015-09-08 09:42:20 +02:00
|
|
|
{
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
goto_record_end ();
|
2015-09-08 09:42:20 +02:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "resume" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_core_target::resume (ptid_t ptid, int step,
|
|
|
|
enum gdb_signal signal)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_resume_step = step;
|
|
|
|
record_full_resumed = 1;
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
record_full_execution_dir = ::execution_direction;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* We are about to start executing the inferior (or simulate it),
|
|
|
|
let's register it with the event loop. */
|
|
|
|
if (target_can_async_p ())
|
Simplify target_async hook interface
All callers of target_async pass it the same callback
(inferior_event_handler). Since both common code and target backends
need to be able to put the target in and out of target async mode at
any given time, there's really no way that a different callback could
be passed. This commit simplifies things, and removes the indirection
altogether. Bonus: with this, gdb's target_async method ends up with
the same signature as gdbserver's.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-25 Pedro Alves <palves@redhat.com>
* target.h <to_async>: Replace 'callback' and 'context' parameters
with boolean 'enable' parameter.
(target_async): Replace CALLBACK and CONTEXT parameters with
boolean ENABLE parameter.
* inf-loop.c (inferior_event_handler): Adjust.
* linux-nat.c (linux_nat_attach, linux_nat_resume)
(linux_nat_resume): Adjust.
(async_client_callback, async_client_context): Delete.
(handle_target_event): Call inferior_event_handler directly.
(linux_nat_async): Replace 'callback' and 'context' parameters
with boolean 'enable' parameter. Adjust. Remove references to
async_client_callback and async_client_context.
(linux_nat_close): Adjust.
* record-btrace.c (record_btrace_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_btrace_resume): Adjust.
* record-full.c (record_full_async): Replace 'callback' and
'context' parameters with boolean 'enable' parameter. Adjust.
(record_full_resume, record_full_core_resume): Adjust.
* remote.c (struct remote_state) <async_client_callback,
async_client_context>: Delete fields.
(remote_start_remote, extended_remote_attach_1, remote_resume)
(extended_remote_create_inferior): Adjust.
(remote_async_serial_handler): Call inferior_event_handler
directly.
(remote_async): Replace 'callback' and 'context' parameters with
boolean 'enable' parameter. Adjust.
* top.c (gdb_readline_wrapper_cleanup, gdb_readline_wrapper):
Adjust.
* target-delegates.c: Regenerate.
2015-03-25 12:28:31 +01:00
|
|
|
target_async (1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "kill" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_core_target::kill ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (record_debug)
|
2013-03-11 09:44:14 +01:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_core_kill\n");
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
unpush_target (this);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "fetch_registers" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_core_target::fetch_registers (struct regcache *regcache,
|
|
|
|
int regno)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (regno < 0)
|
|
|
|
{
|
2017-10-25 17:37:03 +02:00
|
|
|
int num = gdbarch_num_regs (regcache->arch ());
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i ++)
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
regcache->raw_supply (i, *record_full_core_regbuf);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
regcache->raw_supply (regno, *record_full_core_regbuf);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "prepare_to_store" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_core_target::prepare_to_store (struct regcache *regcache)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "store_registers" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_core_target::store_registers (struct regcache *regcache,
|
|
|
|
int regno)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_gdb_operation_disable)
|
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
2018-02-21 12:20:03 +01:00
|
|
|
record_full_core_regbuf->raw_supply (regno, *regcache);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
|
|
|
error (_("You can't do that without a process to debug."));
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "xfer_partial" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
enum target_xfer_status
|
|
|
|
record_full_core_target::xfer_partial (enum target_object object,
|
|
|
|
const char *annex, gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf, ULONGEST offset,
|
|
|
|
ULONGEST len, ULONGEST *xfered_len)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (object == TARGET_OBJECT_MEMORY)
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_gdb_operation_disable || !writebuf)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
struct target_section *p;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
for (p = record_full_core_start; p < record_full_core_end; p++)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
if (offset >= p->addr)
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_core_buf_entry *entry;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
ULONGEST sec_offset;
|
|
|
|
|
|
|
|
if (offset >= p->endaddr)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (offset + len > p->endaddr)
|
|
|
|
len = p->endaddr - offset;
|
|
|
|
|
|
|
|
sec_offset = offset - p->addr;
|
|
|
|
|
|
|
|
/* Read readbuf or write writebuf p, offset, len. */
|
|
|
|
/* Check flags. */
|
|
|
|
if (p->the_bfd_section->flags & SEC_CONSTRUCTOR
|
|
|
|
|| (p->the_bfd_section->flags & SEC_HAS_CONTENTS) == 0)
|
|
|
|
{
|
|
|
|
if (readbuf)
|
|
|
|
memset (readbuf, 0, len);
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
|
|
|
|
*xfered_len = len;
|
|
|
|
return TARGET_XFER_OK;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Get record_full_core_buf_entry. */
|
|
|
|
for (entry = record_full_core_buf_list; entry;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
entry = entry->prev)
|
|
|
|
if (entry->p == p)
|
|
|
|
break;
|
|
|
|
if (writebuf)
|
|
|
|
{
|
|
|
|
if (!entry)
|
|
|
|
{
|
|
|
|
/* Add a new entry. */
|
Replace some xmalloc-family functions with XNEW-family ones
This patch is part of the make-gdb-buildable-in-C++ effort. The idea is
to change some calls to the xmalloc family of functions to calls to the
equivalents in the XNEW family. This avoids adding an explicit cast, so
it keeps the code a bit more readable. Some of them also map relatively
well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be
possible to do scripted replacements if needed.
I only changed calls that were obviously allocating memory for one or
multiple "objects". Allocation of variable sizes (such as strings or
buffer handling) will be for later (and won't use XNEW).
- xmalloc (sizeof (struct foo)) -> XNEW (struct foo)
- xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num)
- xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo)
- xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num)
- xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num)
- obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo)
- obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num)
- alloca (sizeof (struct foo)) -> XALLOCA (struct foo)
- alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num)
Some instances of xmalloc followed by memset to zero the buffer were
replaced by XCNEW or XCNEWVEC.
I regtested on x86-64, Ubuntu 14.04, but the patch touches many
architecture-specific files. For those I'll have to rely on the
buildbot or people complaining that I broke their gdb.
gdb/ChangeLog:
* aarch64-linux-nat.c (aarch64_add_process): Likewise.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* ada-exp.y (write_ambiguous_var): Likewise.
* ada-lang.c (resolve_subexp): Likewise.
(user_select_syms): Likewise.
(assign_aggregate): Likewise.
(ada_evaluate_subexp): Likewise.
(cache_symbol): Likewise.
* addrmap.c (allocate_key): Likewise.
(addrmap_create_mutable): Likewise.
* aix-thread.c (sync_threadlists): Likewise.
* alpha-tdep.c (alpha_push_dummy_call): Likewise.
(alpha_gdbarch_init): Likewise.
* amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise.
* arm-linux-nat.c (arm_linux_add_process): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* arm-tdep.c (push_stack_item): Likewise.
(arm_displaced_step_copy_insn): Likewise.
(arm_gdbarch_init): Likewise.
(_initialize_arm_tdep): Likewise.
* avr-tdep.c (push_stack_item): Likewise.
* ax-general.c (new_agent_expr): Likewise.
* block.c (block_initialize_namespace): Likewise.
* breakpoint.c (alloc_counted_command_line): Likewise.
(update_dprintf_command_list): Likewise.
(parse_breakpoint_sals): Likewise.
(decode_static_tracepoint_spec): Likewise.
(until_break_command): Likewise.
(clear_command): Likewise.
(update_global_location_list): Likewise.
(get_breakpoint_objfile_data) Likewise.
* btrace.c (ftrace_new_function): Likewise.
(btrace_set_insn_history): Likewise.
(btrace_set_call_history): Likewise.
* buildsym.c (add_symbol_to_list): Likewise.
(record_pending_block): Likewise.
(start_subfile): Likewise.
(start_buildsym_compunit): Likewise.
(push_subfile): Likewise.
(end_symtab_get_static_block): Likewise.
(buildsym_init): Likewise.
* cli/cli-cmds.c (source_command): Likewise.
* cli/cli-decode.c (add_cmd): Likewise.
* cli/cli-script.c (build_command_line): Likewise.
(setup_user_args): Likewise.
(realloc_body_list): Likewise.
(process_next_line): Likewise.
(copy_command_lines): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (read_pe_exported_syms): Likewise.
* coffread.c (coff_locate_sections): Likewise.
(coff_symtab_read): Likewise.
(coff_read_struct_type): Likewise.
* common/cleanups.c (make_my_cleanup2): Likewise.
* common/common-exceptions.c (throw_it): Likewise.
* common/filestuff.c (make_cleanup_close): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/queue.h (DEFINE_QUEUE_P): Likewise.
* compile/compile-object-load.c (munmap_list_add): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (append_args): Likewise.
* corefile.c (specify_exec_file_hook): Likewise.
* cp-support.c (make_symbol_overload_list): Likewise.
* cris-tdep.c (push_stack_item): Likewise.
(cris_gdbarch_init): Likewise.
* ctf.c (ctf_trace_file_writer_new): Likewise.
* dbxread.c (init_header_files): Likewise.
(add_new_header_file): Likewise.
(init_bincl_list): Likewise.
(dbx_end_psymtab): Likewise.
(start_psymtab): Likewise.
(dbx_end_psymtab): Likewise.
* dcache.c (dcache_init): Likewise.
* dictionary.c (dict_create_hashed): Likewise.
(dict_create_hashed_expandable): Likewise.
(dict_create_linear): Likewise.
(dict_create_linear_expandable): Likewise.
* dtrace-probe.c (dtrace_process_dof_probe): Likewise.
* dummy-frame.c (register_dummy_frame_dtor): Likewise.
* dwarf2-frame-tailcall.c (cache_new_ref1): Likewise.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
(decode_frame_entry_1): Likewise.
* dwarf2expr.c (new_dwarf_expr_context): Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise.
* dwarf2read.c (dwarf2_has_info): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dw2_get_file_names_reader): Likewise.
(create_all_type_units): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(create_all_comp_units): Likewise.
(queue_comp_unit): Likewise.
(inherit_abstract_dies): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(attr_to_dynamic_prop): Likewise.
(abbrev_table_alloc_abbrev): Likewise.
(abbrev_table_read_table): Likewise.
(add_include_dir): Likewise.
(add_file_name): Likewise.
(dwarf_decode_line_header): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf_alloc_block): Likewise.
(parse_macro_definition): Likewise.
(set_die_type): Likewise.
(write_psymtabs_to_index): Likewise.
(create_cus_from_index): Likewise.
(dwarf2_create_include_psymtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(build_type_psymtab_dependencies): Likewise.
(read_comp_units_from_section): Likewise.
(compute_compunit_symtab_includes): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(load_partial_dies): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_read_minimal_symbols): Likewise.
* environ.c (make_environ): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* event-loop.c (create_file_handler): Likewise.
(create_async_signal_handler): Likewise.
(create_async_event_handler): Likewise.
(create_timer): Likewise.
* exec.c (build_section_table): Likewise.
* fbsd-nat.c (fbsd_remember_child): Likewise.
* fork-child.c (fork_inferior): Likewise.
* frv-tdep.c (new_variant): Likewise.
* gdbarch.sh (gdbarch_alloc): Likewise.
(append_name): Likewise.
* gdbtypes.c (rank_function): Likewise.
(copy_type_recursive): Likewise.
(add_dyn_prop): Likewise.
* gnu-nat.c (make_proc): Likewise.
(make_inf): Likewise.
(gnu_write_inferior): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* guile/scm-param.c (compute_enum_list): Likewise.
* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
* guile/scm-value.c (gdbscm_value_call): Likewise.
* h8300-tdep.c (h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
(read_unwind_info): Likewise.
* ia64-tdep.c (ia64_gdbarch_init): Likewise.
* infcall.c (dummy_frame_context_saver_setup): Likewise.
(call_function_by_hand_dummy): Likewise.
* infcmd.c (step_once): Likewise.
(finish_forward): Likewise.
(attach_command): Likewise.
(notice_new_inferior): Likewise.
* inferior.c (add_inferior_silent): Likewise.
* infrun.c (add_displaced_stepping_state): Likewise.
(save_infcall_control_state): Likewise.
(save_inferior_ptid): Likewise.
(_initialize_infrun): Likewise.
* jit.c (bfd_open_from_target_memory): Likewise.
(jit_gdbarch_data_init): Likewise.
* language.c (add_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* linux-nat.c (add_to_pid_list): Likewise.
(add_initial_lwp): Likewise.
* linux-thread-db.c (add_thread_db_info): Likewise.
(record_thread): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_gdbarch_init): Likewise.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* m68k-tdep.c (m68k_gdbarch_init): Likewise.
* m88k-tdep.c (m88k_analyze_prologue): Likewise.
* macrocmd.c (macro_define_command): Likewise.
* macroexp.c (gather_arguments): Likewise.
* macroscope.c (sal_macro_scope): Likewise.
* macrotab.c (new_macro_table): Likewise.
* mdebugread.c (push_parse_stack): Likewise.
(parse_partial_symbols): Likewise.
(parse_symbol): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_block): Likewise.
(new_psymtab): Likewise.
(mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* mep-tdep.c (mep_gdbarch_init): Likewise.
* mi/mi-main.c (mi_execute_command): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
* minidebug.c (lzma_open): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
* msp430-tdep.c (msp430_gdbarch_init): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise.
* nat/linux-btrace.c (linux_enable_bts): Likewise.
(linux_enable_pt): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise.
(linux_xfer_osdata_processgroups): Likewise.
* nios2-tdep.c (nios2_gdbarch_init): Likewise.
* nto-procfs.c (procfs_meminfo): Likewise.
* objc-lang.c (start_msglist): Likewise.
(selectors_info): Likewise.
(classes_info): Likewise.
(find_methods): Likewise.
* objfiles.c (allocate_objfile): Likewise.
(update_section_map): Likewise.
* osabi.c (gdbarch_register_osabi): Likewise.
(gdbarch_register_osabi_sniffer): Likewise.
* parse.c (start_arglist): Likewise.
* ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise.
(hwdebug_insert_point): Likewise.
* printcmd.c (display_command): Likewise.
(ui_printf): Likewise.
* procfs.c (create_procinfo): Likewise.
(load_syscalls): Likewise.
(proc_get_LDT_entry): Likewise.
(proc_update_threads): Likewise.
* prologue-value.c (make_pv_area): Likewise.
(pv_area_store): Likewise.
* psymtab.c (extend_psymbol_list): Likewise.
(init_psymbol_list): Likewise.
(allocate_psymtab): Likewise.
* python/py-inferior.c (add_thread_object): Likewise.
* python/py-param.c (compute_enum_values): Likewise.
* python/py-value.c (valpy_call): Likewise.
* python/py-varobj.c (py_varobj_iter_next): Likewise.
* python/python.c (ensure_python_env): Likewise.
* record-btrace.c (record_btrace_start_replaying): Likewise.
* record-full.c (record_full_reg_alloc): Likewise.
(record_full_mem_alloc): Likewise.
(record_full_end_alloc): Likewise.
(record_full_core_xfer_partial): Likewise.
* regcache.c (get_thread_arch_aspace_regcache): Likewise.
* remote-fileio.c (remote_fileio_init_fd_map): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (demand_private_info): Likewise.
(remote_notif_stop_alloc_reply): Likewise.
(remote_enable_btrace): Likewise.
* reverse.c (save_bookmark_command): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
* rx-tdep.c (rx_gdbarch_init): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
* ser-go32.c (dos_get_tty_state): Likewise.
(dos_copy_tty_state): Likewise.
* ser-mingw.c (ser_windows_open): Likewise.
(ser_console_wait_handle): Likewise.
(ser_console_get_tty_state): Likewise.
(make_pipe_state): Likewise.
(net_windows_open): Likewise.
* ser-unix.c (hardwire_get_tty_state): Likewise.
(hardwire_copy_tty_state): Likewise.
* solib-aix.c (solib_aix_new_lm_info): Likewise.
* solib-dsbt.c (dsbt_current_sos): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (frv_current_sos): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_bfd_fopen): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(svr4_copy_library_list): Likewise.
(svr4_default_sos): Likewise.
* source.c (find_source_lines): Likewise.
(line_info): Likewise.
(add_substitute_path_rule): Likewise.
* spu-linux-nat.c (spu_bfd_open): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stabsread.c (dbx_lookup_type): Likewise.
(read_type): Likewise.
(read_member_functions): Likewise.
(read_struct_fields): Likewise.
(read_baseclasses): Likewise.
(read_args): Likewise.
(_initialize_stabsread): Likewise.
* stack.c (func_command): Likewise.
* stap-probe.c (handle_stap_probe): Likewise.
* symfile.c (addrs_section_sort): Likewise.
(addr_info_make_relative): Likewise.
(load_section_callback): Likewise.
(add_symbol_file_command): Likewise.
(init_filename_language_table): Likewise.
* symtab.c (create_filename_seen_cache): Likewise.
(sort_search_symbols_remove_dups): Likewise.
(search_symbols): Likewise.
* target.c (make_cleanup_restore_target_terminal): Likewise.
* thread.c (new_thread): Likewise.
(enable_thread_stack_temporaries): Likewise.
(make_cleanup_restore_current_thread): Likewise.
(thread_apply_all_command): Likewise.
* tic6x-tdep.c (tic6x_gdbarch_init): Likewise.
* top.c (gdb_readline_wrapper): Likewise.
* tracefile-tfile.c (tfile_trace_file_writer_new): Likewise.
* tracepoint.c (trace_find_line_command): Likewise.
(all_tracepoint_actions_and_cleanup): Likewise.
(make_cleanup_restore_current_traceframe): Likewise.
(get_uploaded_tp): Likewise.
(get_uploaded_tsv): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_alloc_content): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-disasm.c (tui_find_disassembly_address): Likewise.
(tui_set_disassem_content): Likewise.
* ui-file.c (ui_file_new): Likewise.
(stdio_file_new): Likewise.
(tee_file_new): Likewise.
* utils.c (make_cleanup_restore_integer): Likewise.
(add_internal_problem_command): Likewise.
* v850-tdep.c (v850_gdbarch_init): Likewise.
* valops.c (find_oload_champ): Likewise.
* value.c (allocate_value_lazy): Likewise.
(record_latest_value): Likewise.
(create_internalvar): Likewise.
* varobj.c (install_variable): Likewise.
(new_variable): Likewise.
(new_root_variable): Likewise.
(cppush): Likewise.
(_initialize_varobj): Likewise.
* windows-nat.c (windows_make_so): Likewise.
* x86-nat.c (x86_add_process): Likewise.
* xcoffread.c (arrange_linetable): Likewise.
(allocate_include_entry): Likewise.
(process_linenos): Likewise.
(SYMBOL_DUP): Likewise.
(xcoff_start_psymtab): Likewise.
(xcoff_end_psymtab): Likewise.
* xml-support.c (gdb_xml_parse_attr_ulongest): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Likewise.
(compile_bytecodes): Likewise.
* dll.c (loaded_dll): Likewise.
* event-loop.c (append_callback_event): Likewise.
(create_file_handler): Likewise.
(create_file_event): Likewise.
* hostio.c (handle_open): Likewise.
* inferiors.c (add_thread): Likewise.
(add_process): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_process): Likewise.
* linux-arm-low.c (arm_new_process): Likewise.
(arm_new_thread): Likewise.
* linux-low.c (add_to_pid_list): Likewise.
(linux_add_process): Likewise.
(handle_extended_wait): Likewise.
(add_lwp): Likewise.
(enqueue_one_deferred_signal): Likewise.
(enqueue_pending_signal): Likewise.
(linux_resume_one_lwp_throw): Likewise.
(linux_resume_one_thread): Likewise.
(linux_read_memory): Likewise.
(linux_write_memory): Likewise.
* linux-mips-low.c (mips_linux_new_process): Likewise.
(mips_linux_new_thread): Likewise.
(mips_add_watchpoint): Likewise.
* linux-x86-low.c (initialize_low_arch): Likewise.
* lynx-low.c (lynx_add_process): Likewise.
* mem-break.c (set_raw_breakpoint_at): Likewise.
(set_breakpoint): Likewise.
(add_condition_to_breakpoint): Likewise.
(add_commands_to_breakpoint): Likewise.
(clone_agent_expr): Likewise.
(clone_one_breakpoint): Likewise.
* regcache.c (new_register_cache): Likewise.
* remote-utils.c (look_up_one_symbol): Likewise.
* server.c (queue_stop_reply): Likewise.
(start_inferior): Likewise.
(queue_stop_reply_callback): Likewise.
(handle_target_event): Likewise.
* spu-low.c (fetch_ppc_memory): Likewise.
(store_ppc_memory): Likewise.
* target.c (set_target_ops): Likewise.
* thread-db.c (thread_db_load_search): Likewise.
(try_thread_db_load_1): Likewise.
* tracepoint.c (add_tracepoint): Likewise.
(add_tracepoint_action): Likewise.
(create_trace_state_variable): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtro): Likewise.
(add_while_stepping_state): Likewise.
* win32-low.c (child_add_thread): Likewise.
(get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
|
|
|
entry = XNEW (struct record_full_core_buf_entry);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
entry->p = p;
|
2013-07-16 22:41:55 +02:00
|
|
|
if (!bfd_malloc_and_get_section
|
|
|
|
(p->the_bfd_section->owner,
|
|
|
|
p->the_bfd_section,
|
|
|
|
&entry->buf))
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
xfree (entry);
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
return TARGET_XFER_EOF;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
2013-03-11 09:44:14 +01:00
|
|
|
entry->prev = record_full_core_buf_list;
|
|
|
|
record_full_core_buf_list = entry;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
memcpy (entry->buf + sec_offset, writebuf,
|
|
|
|
(size_t) len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!entry)
|
2018-06-07 18:27:47 +02:00
|
|
|
return this->beneath ()->xfer_partial (object, annex,
|
|
|
|
readbuf, writebuf,
|
|
|
|
offset, len,
|
|
|
|
xfered_len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
memcpy (readbuf, entry->buf + sec_offset,
|
|
|
|
(size_t) len);
|
|
|
|
}
|
|
|
|
|
Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from
LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);
to
enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN. Generally, the return status has three stats,
- TARGET_XFER_OK,
- TARGET_XFER_EOF,
- TARGET_XFER_E_XXXX,
See the comments to them in 'enum target_xfer_status'. Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF.
With this change, GDB core can handle unavailable data in a convenient
way.
The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html
Consider an object/value like this:
0 100 150 200 512
DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III
where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid). Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out. But, in this scenario, we're interested in
the data at [150,512). The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next. We'd need something like:
get me [0,512) >>>
<<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK
get me [100,512) >>> (**1)
<<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.
get me [150,512) >>>
<<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.
get me [200,512) >>>
<<< no more data, return TARGET_XFER_EOF.
This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target. (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).
Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.
No target implementations to to_xfer_partial adapts this new
interface. The interface still behaves as before.
gdb:
2014-02-11 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it. New. All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status. Add argument xfered_len. Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it. New. All callers
updated.
(target_read_live_memory): Likewise. Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status. Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise. Check *XFERED_LEN is set
properly. Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise. All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.
* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise. All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise. All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise. All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise. All
callers updated.
(remote_flash_erase): Likewise. All callers updated.
(remote_write_qxfer): Likewise. All callers updated.
(remote_read_qxfer): Likewise. All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.
2014-01-27 13:35:33 +01:00
|
|
|
*xfered_len = len;
|
|
|
|
return TARGET_XFER_OK;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-27 10:32:33 +01:00
|
|
|
return TARGET_XFER_E_IO;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
error (_("You can't do that without a process to debug."));
|
|
|
|
}
|
|
|
|
|
2018-06-07 18:27:47 +02:00
|
|
|
return this->beneath ()->xfer_partial (object, annex,
|
|
|
|
readbuf, writebuf, offset, len,
|
|
|
|
xfered_len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "insert_breakpoint" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
int
|
|
|
|
record_full_core_target::insert_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
struct bp_target_info *bp_tgt)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "remove_breakpoint" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
int
|
|
|
|
record_full_core_target::remove_breakpoint (struct gdbarch *gdbarch,
|
|
|
|
struct bp_target_info *bp_tgt,
|
|
|
|
enum remove_bp_reason reason)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
/* "has_execution" method for prec over corefile. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
bool
|
Make target_ops::has_execution take an 'inferior *' instead of a ptid_t
With the multi-target work, each inferior will have its own target
stack, so to call a target method, we'll need to make sure that the
inferior in question is the current one, otherwise target->beneath()
calls will find the target beneath in the wrong inferior.
In some places, it's much more convenient to be able to check whether
an inferior has execution without having to switch to it in order to
call target_has_execution on the right inferior/target stack, to avoid
side effects with switching inferior/thread/program space.
The current target_ops::has_execution method takes a ptid_t as
parameter, which, in a multi-target world, isn't sufficient to
identify the target. This patch prepares to address that, by changing
the parameter to an inferior pointer instead. From the inferior,
we'll be able to query its target stack to tell which target is
beneath.
Also adds a new inferior::has_execution() method to make callers a bit
more natural to read.
gdb/ChangeLog:
2020-01-10 Pedro Alves <palves@redhat.com>
* corelow.c (core_target::has_execution): Change parameter type to
inferior pointer.
* inferior.c (number_of_live_inferiors): Use
inferior::has_execution instead of target_has_execution_1.
* inferior.h (inferior::has_execution): New.
* linux-thread-db.c (thread_db_target::update_thread_list): Use
inferior::has_execution instead of target_has_execution_1.
* process-stratum-target.c
(process_stratum_target::has_execution): Change parameter type to
inferior pointer. Check the inferior's PID instead of
inferior_ptid.
* process-stratum-target.h
(process_stratum_target::has_execution): Change parameter type to
inferior pointer.
* record-full.c (record_full_core_target::has_execution): Change
parameter type to inferior pointer.
* target.c (target_has_execution_1): Change parameter type to
inferior pointer.
(target_has_execution_current): Adjust.
* target.h (target_ops::has_execution): Change parameter type to
inferior pointer.
(target_has_execution_1): Change parameter type to inferior
pointer. Change return type to bool.
* tracefile.h (tracefile_target::has_execution): Change parameter
type to inferior pointer.
2020-01-10 21:05:44 +01:00
|
|
|
record_full_core_target::has_execution (inferior *inf)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
target_ops: Use bool throughout
After the previous target_ops/C++ patches are all squashed and merged,
this one can go in separately.
This patch adjusts all the target methods to return bool instead of int
when they're returning a boolean.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* target.h (target_ops)
<stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint,
stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint,
stopped_by_watchpoint, have_continuable_watchpoint,
stopped_data_address, watchpoint_addr_within_range,
can_accel_watchpoint_condition, can_run, thread_alive,
has_all_memory, has_memory, has_stack, has_registers,
has_execution, can_async_p, is_async_p, supports_non_stop,
always_non_stop_p, can_execute_reverse, supports_multi_process,
supports_enable_disable_tracepoint,
supports_disable_randomization, supports_string_tracing,
supports_evaluation_of_breakpoint_conditions,
can_run_breakpoint_commands, filesystem_is_local,
can_download_tracepoint, get_trace_state_variable_value,
set_trace_notes, get_tib_address, use_agent, can_use_agent,
record_is_replaying, record_will_replay,
augmented_libraries_svr4_read>: Adjust to return bool.
* aarch64-linux-nat.c: All implementations adjusted.
* aix-thread.c: All implementations adjusted.
* arm-linux-nat.c: All implementations adjusted.
* breakpoint.c: All implementations adjusted.
* bsd-kvm.c: All implementations adjusted.
* bsd-uthread.c: All implementations adjusted.
* corelow.c: All implementations adjusted.
* ctf.c: All implementations adjusted.
* darwin-nat.c: All implementations adjusted.
* darwin-nat.h: All implementations adjusted.
* exec.c: All implementations adjusted.
* fbsd-nat.c: All implementations adjusted.
* fbsd-nat.h: All implementations adjusted.
* gnu-nat.c: All implementations adjusted.
* gnu-nat.h: All implementations adjusted.
* go32-nat.c: All implementations adjusted.
* ia64-linux-nat.c: All implementations adjusted.
* inf-child.c: All implementations adjusted.
* inf-child.h: All implementations adjusted.
* inf-ptrace.c: All implementations adjusted.
* inf-ptrace.h: All implementations adjusted.
* linux-nat.c: All implementations adjusted.
* linux-nat.h: All implementations adjusted.
* mips-linux-nat.c: All implementations adjusted.
* nto-procfs.c: All implementations adjusted.
* ppc-linux-nat.c: All implementations adjusted.
* procfs.c: All implementations adjusted.
* ravenscar-thread.c: All implementations adjusted.
* record-btrace.c: All implementations adjusted.
* record-full.c: All implementations adjusted.
* remote-sim.c: All implementations adjusted.
* remote.c: All implementations adjusted.
* s390-linux-nat.c: All implementations adjusted.
* sol-thread.c: All implementations adjusted.
* spu-multiarch.c: All implementations adjusted.
* target-delegates.c: All implementations adjusted.
* target.c: All implementations adjusted.
* target.h: All implementations adjusted.
* tracefile-tfile.c: All implementations adjusted.
* tracefile.c: All implementations adjusted.
* tracefile.h: All implementations adjusted.
* windows-nat.c: All implementations adjusted.
* x86-linux-nat.h: All implementations adjusted.
* x86-nat.h: All implementations adjusted.
2018-05-03 01:37:26 +02:00
|
|
|
return true;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Record log save-file format
|
|
|
|
Version 1 (never released)
|
|
|
|
|
|
|
|
Header:
|
|
|
|
4 bytes: magic number htonl(0x20090829).
|
|
|
|
NOTE: be sure to change whenever this file format changes!
|
|
|
|
|
|
|
|
Records:
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_end:
|
|
|
|
1 byte: record type (record_full_end, see enum record_full_type).
|
|
|
|
record_full_reg:
|
|
|
|
1 byte: record type (record_full_reg, see enum record_full_type).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
8 bytes: register id (network byte order).
|
|
|
|
MAX_REGISTER_SIZE bytes: register value.
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_mem:
|
|
|
|
1 byte: record type (record_full_mem, see enum record_full_type).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
8 bytes: memory length (network byte order).
|
|
|
|
8 bytes: memory address (network byte order).
|
|
|
|
n bytes: memory value (n == memory length).
|
|
|
|
|
|
|
|
Version 2
|
|
|
|
4 bytes: magic number netorder32(0x20091016).
|
|
|
|
NOTE: be sure to change whenever this file format changes!
|
|
|
|
|
|
|
|
Records:
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_end:
|
|
|
|
1 byte: record type (record_full_end, see enum record_full_type).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
4 bytes: signal
|
|
|
|
4 bytes: instruction count
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_reg:
|
|
|
|
1 byte: record type (record_full_reg, see enum record_full_type).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
4 bytes: register id (network byte order).
|
|
|
|
n bytes: register value (n == actual register size).
|
|
|
|
(eg. 4 bytes for x86 general registers).
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_mem:
|
|
|
|
1 byte: record type (record_full_mem, see enum record_full_type).
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
4 bytes: memory length (network byte order).
|
|
|
|
8 bytes: memory address (network byte order).
|
|
|
|
n bytes: memory value (n == memory length).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* bfdcore_read -- read bytes from a core file section. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
bfdcore_read (bfd *obfd, asection *osec, void *buf, int len, int *offset)
|
|
|
|
{
|
|
|
|
int ret = bfd_get_section_contents (obfd, osec, buf, *offset, len);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
*offset += len;
|
|
|
|
else
|
|
|
|
error (_("Failed to read %d bytes from core file %s ('%s')."),
|
|
|
|
len, bfd_get_filename (obfd),
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint64_t
|
|
|
|
netorder64 (uint64_t input)
|
|
|
|
{
|
|
|
|
uint64_t ret;
|
|
|
|
|
|
|
|
store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
|
|
|
|
BFD_ENDIAN_BIG, input);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
netorder32 (uint32_t input)
|
|
|
|
{
|
|
|
|
uint32_t ret;
|
|
|
|
|
|
|
|
store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
|
|
|
|
BFD_ENDIAN_BIG, input);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore the execution log from a core_bfd file. */
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_restore (void)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
uint32_t magic;
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *rec;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
asection *osec;
|
|
|
|
uint32_t osec_size;
|
|
|
|
int bfd_offset = 0;
|
|
|
|
struct regcache *regcache;
|
|
|
|
|
|
|
|
/* We restore the execution log from the open core bfd,
|
|
|
|
if there is one. */
|
|
|
|
if (core_bfd == NULL)
|
|
|
|
return;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* "record_full_restore" can only be called when record list is empty. */
|
|
|
|
gdb_assert (record_full_first.next == NULL);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "Restoring recording from core file.\n");
|
|
|
|
|
|
|
|
/* Now need to find our special note section. */
|
|
|
|
osec = bfd_get_section_by_name (core_bfd, "null0");
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "Find precord section %s.\n",
|
|
|
|
osec ? "succeeded" : "failed");
|
|
|
|
if (osec == NULL)
|
|
|
|
return;
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
|
|
|
osec_size = bfd_section_size (osec);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
|
|
|
fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (osec));
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Check the magic code. */
|
|
|
|
bfdcore_read (core_bfd, osec, &magic, sizeof (magic), &bfd_offset);
|
2013-03-11 09:44:14 +01:00
|
|
|
if (magic != RECORD_FULL_FILE_MAGIC)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
error (_("Version mis-match or file format error in core file %s."),
|
|
|
|
bfd_get_filename (core_bfd));
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Reading 4-byte magic cookie "
|
2013-03-11 09:44:14 +01:00
|
|
|
"RECORD_FULL_FILE_MAGIC (0x%s)\n",
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
phex_nz (netorder32 (magic), 4));
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Restore the entries in recfd into record_full_arch_list_head and
|
|
|
|
record_full_arch_list_tail. */
|
|
|
|
record_full_arch_list_head = NULL;
|
|
|
|
record_full_arch_list_tail = NULL;
|
|
|
|
record_full_insn_num = 0;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2019-04-04 00:02:42 +02:00
|
|
|
try
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2018-06-07 23:56:37 +02:00
|
|
|
regcache = get_current_regcache ();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
uint8_t rectype;
|
|
|
|
uint32_t regnum, len, signal, count;
|
|
|
|
uint64_t addr;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* We are finished when offset reaches osec_size. */
|
|
|
|
if (bfd_offset >= osec_size)
|
|
|
|
break;
|
|
|
|
bfdcore_read (core_bfd, osec, &rectype, sizeof (rectype), &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
switch (rectype)
|
|
|
|
{
|
|
|
|
case record_full_reg: /* reg */
|
|
|
|
/* Get register number to regnum. */
|
|
|
|
bfdcore_read (core_bfd, osec, ®num,
|
|
|
|
sizeof (regnum), &bfd_offset);
|
|
|
|
regnum = netorder32 (regnum);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
rec = record_full_reg_alloc (regcache, regnum);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Get val. */
|
|
|
|
bfdcore_read (core_bfd, osec, record_full_get_loc (rec),
|
|
|
|
rec->u.reg.len, &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Reading register %d (1 "
|
|
|
|
"plus %lu plus %d bytes)\n",
|
|
|
|
rec->u.reg.num,
|
|
|
|
(unsigned long) sizeof (regnum),
|
|
|
|
rec->u.reg.len);
|
|
|
|
break;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
case record_full_mem: /* mem */
|
|
|
|
/* Get len. */
|
|
|
|
bfdcore_read (core_bfd, osec, &len,
|
|
|
|
sizeof (len), &bfd_offset);
|
|
|
|
len = netorder32 (len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Get addr. */
|
|
|
|
bfdcore_read (core_bfd, osec, &addr,
|
|
|
|
sizeof (addr), &bfd_offset);
|
|
|
|
addr = netorder64 (addr);
|
|
|
|
|
|
|
|
rec = record_full_mem_alloc (addr, len);
|
|
|
|
|
|
|
|
/* Get val. */
|
|
|
|
bfdcore_read (core_bfd, osec, record_full_get_loc (rec),
|
|
|
|
rec->u.mem.len, &bfd_offset);
|
|
|
|
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Reading memory %s (1 plus "
|
|
|
|
"%lu plus %lu plus %d bytes)\n",
|
|
|
|
paddress (get_current_arch (),
|
|
|
|
rec->u.mem.addr),
|
|
|
|
(unsigned long) sizeof (addr),
|
|
|
|
(unsigned long) sizeof (len),
|
|
|
|
rec->u.mem.len);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case record_full_end: /* end */
|
|
|
|
rec = record_full_end_alloc ();
|
|
|
|
record_full_insn_num ++;
|
|
|
|
|
|
|
|
/* Get signal value. */
|
|
|
|
bfdcore_read (core_bfd, osec, &signal,
|
|
|
|
sizeof (signal), &bfd_offset);
|
|
|
|
signal = netorder32 (signal);
|
|
|
|
rec->u.end.sigval = (enum gdb_signal) signal;
|
|
|
|
|
|
|
|
/* Get insn count. */
|
|
|
|
bfdcore_read (core_bfd, osec, &count,
|
|
|
|
sizeof (count), &bfd_offset);
|
|
|
|
count = netorder32 (count);
|
|
|
|
rec->u.end.insn_num = count;
|
|
|
|
record_full_insn_count = count + 1;
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Reading record_full_end (1 + "
|
|
|
|
"%lu + %lu bytes), offset == %s\n",
|
|
|
|
(unsigned long) sizeof (signal),
|
|
|
|
(unsigned long) sizeof (count),
|
|
|
|
paddress (get_current_arch (),
|
|
|
|
bfd_offset));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error (_("Bad entry type in core file %s."),
|
|
|
|
bfd_get_filename (core_bfd));
|
|
|
|
break;
|
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2018-06-07 23:56:37 +02:00
|
|
|
/* Add rec to record arch list. */
|
|
|
|
record_full_arch_list_add (rec);
|
|
|
|
}
|
|
|
|
}
|
2019-04-03 23:59:07 +02:00
|
|
|
catch (const gdb_exception &ex)
|
2018-06-07 23:56:37 +02:00
|
|
|
{
|
|
|
|
record_full_list_release (record_full_arch_list_tail);
|
Replace throw_exception with throw in some cases
This replaces throw_exception with "throw;" when possible. This was
written by script. The rule that is followed is that uses of the
form:
catch (... &name)
{
...
throw_exception (name);
}
... can be rewritten. This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.
gdb/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.
gdb/gdbserver/ChangeLog
2019-04-08 Tom Tromey <tom@tromey.com>
* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.
2019-01-28 18:45:45 +01:00
|
|
|
throw;
|
2018-06-07 23:56:37 +02:00
|
|
|
}
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Add record_full_arch_list_head to the end of record list. */
|
|
|
|
record_full_first.next = record_full_arch_list_head;
|
|
|
|
record_full_arch_list_head->prev = &record_full_first;
|
|
|
|
record_full_arch_list_tail->next = NULL;
|
|
|
|
record_full_list = &record_full_first;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Update record_full_insn_max_num. */
|
|
|
|
if (record_full_insn_num > record_full_insn_max_num)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_max_num = record_full_insn_num;
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
warning (_("Auto increase record/replay buffer limit to %u."),
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_insn_max_num);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Succeeded. */
|
|
|
|
printf_filtered (_("Restored records from core file %s.\n"),
|
|
|
|
bfd_get_filename (core_bfd));
|
|
|
|
|
PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...
(gdb) b start
(gdb) c
...
(gdb) list
*lists "start"*
(gdb) b 23
Breakpoint 3 at 0x400614: file test.c, line 23.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
(gdb) b 23
Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
^^^^^^^^^^^^^^^
(gdb) list
93 lll_wait_tid (pd->tid);
94
95
96 /* Restore cancellation mode. */
97 CANCEL_RESET (oldtype);
98
99 /* Remove the handler. */
100 pthread_cleanup_pop (0);
101
102
The issue is that print_stack_frame always sets the current sal to the
frame's sal. print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION. Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO. What we have is two logically
distinct operations mixed in the same function(s):
#1 - print frame, in the format specified by {print_what,
print_level and print_args}.
#2 - We're displaying a frame to the user, and I want the default
sal to point here, because the program stopped here, or the user
did some context-changing command (up, down, etc.).
So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.
Tested on x86_64 Fedora 17.
gdb/
2013-09-17 Pedro Alves <palves@redhat.com>
PR gdb/15911
* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
* corelow.c (core_open):
* frame.h (print_stack_frame, print_frame_info): New
'set_current_sal' parameter.
* infcmd.c (finish_command, kill_command): Adjust call to
print_stack_frame.
* inferior.c (inferior_command): Likewise.
* infrun.c (normal_stop): Likewise.
* linux-fork.c (linux_fork_context): Likewise.
* record-full.c (record_full_goto_entry, record_full_restore):
Likewise.
* remote-mips.c (common_open): Likewise.
* stack.c (print_stack_frame): New 'set_current_sal' parameter.
Use it.
(print_frame_info): New 'set_current_sal' parameter. Set the last
displayed sal depending on the new paremeter instead of looking at
print_what.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust call to
print_stack_frame.
* thread.c (print_thread_info, restore_selected_frame)
(do_captured_thread_select): Adjust call to print_stack_frame.
* tracepoint.c (tfind_1): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Likewise.
* mi/mi-interp.c (mi_on_normal_stop): Likewise.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.
gdb/testsuite/
* gdb.threads/info-threads-cur-sal-2.c: New file.
* gdb.threads/info-threads-cur-sal.c: New file.
* gdb.threads/info-threads-cur-sal.exp: New file.
2013-09-17 20:26:41 +02:00
|
|
|
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bfdcore_write -- write bytes into a core file section. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
bfdcore_write (bfd *obfd, asection *osec, void *buf, int len, int *offset)
|
|
|
|
{
|
|
|
|
int ret = bfd_set_section_contents (obfd, osec, buf, *offset, len);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
*offset += len;
|
|
|
|
else
|
|
|
|
error (_("Failed to write %d bytes to core file %s ('%s')."),
|
|
|
|
len, bfd_get_filename (obfd),
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore the execution log from a file. We use a modified elf
|
|
|
|
corefile format, with an extra section for our data. */
|
|
|
|
|
|
|
|
static void
|
2017-09-10 05:31:57 +02:00
|
|
|
cmd_record_full_restore (const char *args, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
core_file_command (args, from_tty);
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
record_full_open (args, from_tty);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the execution log to a file. We use a modified elf corefile
|
|
|
|
format, with an extra section for our data. */
|
|
|
|
|
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of
function pointers.
Unfortunately, there's no way to do a smooth transition. ALL native
targets in the tree must be converted at the same time. I've tested
all I could with cross compilers and with help from GCC compile farm,
but naturally I haven't been able to test many of the ports. Still, I
made a best effort to port everything over, and while I expect some
build problems due to typos and such, which should be trivial to fix,
I don't expect any design problems.
* Implementation notes:
- The flattened current_target is gone. References to current_target
or current_target.beneath are replaced with references to
target_stack (the top of the stack) directly.
- To keep "set debug target" working, this adds a new debug_stratum
layer that sits on top of the stack, prints the debug, and delegates
to the target beneath.
In addition, this makes the shortname and longname properties of
target_ops be virtual methods instead of data fields, and makes the
debug target defer those to the target beneath. This is so that
debug code sprinkled around that does "if (debugtarget) ..." can
transparently print the name of the target beneath.
A patch later in the series actually splits out the
shortname/longname methods to a separate structure, but I preferred
to keep that chance separate as it is associated with changing a bit
the design of how targets are registered and open.
- Since you can't check whether a C++ virtual method is overridden,
the old method of checking whether a target_ops implements a method
by comparing the function pointer must be replaced with something
else.
Some cases are fixed by adding a parallel "can_do_foo" target_ops
methods. E.g.,:
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
Others are fixed by changing void return type to bool or int return
type, and have the default implementation return false or -1, to
indicate lack of support.
- make-target-delegates was adjusted to generate C++ classes and
methods.
It needed tweaks to grok "virtual" in front of the target method
name, and for the fact that methods are no longer function pointers.
(In particular, the current code parsing the return type was simple
because it could simply parse up until the '(' in '(*to_foo)'.
It now generates a couple C++ classes that inherit target_ops:
dummy_target and debug_target.
Since we need to generate the class declarations as well, i.e., we
need to emit methods twice, we now generate the code in two passes.
- The core_target global is renamed to avoid conflict with the
"core_target" class.
- ctf/tfile targets
init_tracefile_ops is replaced by a base class that is inherited by
both ctf and tfile.
- bsd-uthread
The bsd_uthread_ops_hack hack is gone. It's not needed because
nothing was extending a target created by bsd_uthread_target.
- remote/extended-remote targets
This is a first pass, just enough to C++ify target_ops.
A later pass will convert more free functions to methods, and make
remote_state be truly per remote instance, allowing multiple
simultaneous instances of remote targets.
- inf-child/"native" is converted to an actual base class
(inf_child_target), that is inherited by all native targets.
- GNU/Linux
The old weird double-target linux_ops mechanism in linux-nat.c, is
gone, replaced by adding a few virtual methods to linux-nat.h's
target_ops, called low_XXX, that the concrete linux-nat
implementations override. Sort of like gdbserver's
linux_target_ops, but simpler, for requiring only one
target_ops-like hierarchy, which spares implementing the same method
twice when we need to forward the method to a low implementation.
The low target simply reimplements the target_ops method directly in
that case.
There are a few remaining linux-nat.c hooks that would be better
converted to low_ methods like above too. E.g.:
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process
That'll be done in a follow up patch.
- We can no longer use functions like x86_use_watchpoints to install
custom methods on an arbitrary base target.
The patch replaces instances of such a pattern with template mixins.
For example memory_breakpoint_target defined in target.h, or
x86_nat_target in x86-nat.h.
- linux_trad_target, MIPS and Alpha GNU/Linux
The code in the new linux-nat-trad.h/c files which was split off of
inf-ptrace.h/c recently, is converted to a C++ base class, and used
by the MIPS and Alpha GNU/Linux ports.
- BSD targets
The
$architecture x NetBSD/OpenBSD/FreeBSD
support matrix complicates things a bit. There's common BSD target
code, and there's common architecture-specific code shared between
the different BSDs. Currently, all that is stiched together to form
a final target, via the i386bsd_target, x86bsd_target,
fbsd_nat_add_target functions etc.
This introduces new fbsd_nat_target, obsd_nat_target and
nbsd_nat_target classes that serve as base/prototype target for the
corresponding BSD variant.
And introduces generic i386/AMD64 BSD targets, to be used as
template mixin to build a final target. Similarly, a generic SPARC
target is added, used by both BSD and Linux ports.
- bsd_kvm_add_target, BSD libkvm target
I considered making bsd_kvm_supply_pcb a virtual method, and then
have each port inherit bsd_kvm_target and override that method, but
that was resulting in lots of unjustified churn, so I left the
function pointer mechanism alone.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
John Baldwin <jhb@freebsd.org>
* target.h (enum strata) <debug_stratum>: New.
(struct target_ops) <all delegation methods>: Replace by C++
virtual methods, and drop "to_" prefix. All references updated
throughout.
<to_shortname, to_longname, to_doc, to_data,
to_have_steppable_watchpoint, to_have_continuable_watchpoint,
to_has_thread_control, to_attach_no_wait>: Delete, replaced by
virtual methods. All references updated throughout.
<can_attach, supports_terminal_ours, can_create_inferior,
get_thread_control_capabilities, attach_no_wait>: New
virtual methods.
<insert_breakpoint, remove_breakpoint>: Now
TARGET_DEFAULT_NORETURN methods.
<info_proc>: Now returns bool.
<to_magic>: Delete.
(OPS_MAGIC): Delete.
(current_target): Delete. All references replaced by references
to ...
(target_stack): ... this. New.
(target_shortname, target_longname): Adjust.
(target_can_run): Now a function declaration.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(memory_breakpoint_target): New template class.
(test_target_ops): Refactor as a C++ class with virtual methods.
* make-target-delegates (NAME_PART): Tighten.
(POINTER_PART, CP_SYMBOL): New.
(SIMPLE_RETURN_PART): Reimplement.
(VEC_RETURN_PART): Expect less.
(RETURN_PART, VIRTUAL_PART): New.
(METHOD): Adjust to C++ virtual methods.
(scan_target_h): Remove reference to C99.
(dname): Output "target_ops::" prefix.
(write_function_header): Adjust to output a C++ class method.
(write_declaration): New.
(write_delegator): Adjust to output a C++ class method.
(tdname): Output "dummy_target::" prefix.
(write_tdefault, write_debugmethod): Adjust to output a C++ class
method.
(tdefault_names, debug_names): Delete.
(return_types, tdefaults, styles, argtypes_array): New.
(top level): All methods are delegators.
(print_class): New.
(top level): Print dummy_target and debug_target classes.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_info_proc_what)
(target_debug_print_thread_control_capabilities)
(target_debug_print_thread_info_p): New.
* target.c (dummy_target): Delete.
(the_dummy_target, the_debug_target): New.
(target_stack): Now extern.
(set_targetdebug): Push/unpush debug target.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Remove target_ops parameter.
(complete_target_initialization): Delete.
(add_target_with_completer): No longer call
complete_target_initialization.
(target_supports_terminal_ours): Use regular delegation.
(update_current_target): Delete.
(push_target): No longer check magic number. Don't call
update_current_target.
(unpush_target): Don't call update_current_target.
(target_is_pushed): No longer check magic number.
(target_require_runnable): Skip for all stratums over
process_stratum.
(target_ops::info_proc): New.
(target_info_proc): Use find_target_at and
find_default_run_target.
(target_supports_disable_randomization): Use regular delegation.
(target_get_osdata): Use find_target_at.
(target_ops::open, target_ops::close, target_ops::can_attach)
(target_ops::attach, target_ops::can_create_inferior)
(target_ops::create_inferior, target_ops::can_run)
(target_can_run): New.
(default_fileio_target): Use regular delegation.
(target_ops::fileio_open, target_ops::fileio_pwrite)
(target_ops::fileio_pread, target_ops::fileio_fstat)
(target_ops::fileio_close, target_ops::fileio_unlink)
(target_ops::fileio_readlink): New.
(target_fileio_open_1, target_fileio_unlink)
(target_fileio_readlink): Always call the target method. Handle
FILEIO_ENOSYS.
(return_zero, return_zero_has_execution): Delete.
(init_dummy_target): Delete.
(dummy_target::dummy_target, dummy_target::shortname)
(dummy_target::longname, dummy_target::doc)
(debug_target::debug_target, debug_target::shortname)
(debug_target::longname, debug_target::doc): New.
(target_supports_delete_record): Use regular delegation.
(setup_target_debug): Delete.
(maintenance_print_target_stack): Skip debug_stratum.
(initialize_targets): Instantiate the_dummy_target and
the_debug_target.
* auxv.c (target_auxv_parse): Remove 'ops' parameter. Adjust to
use target_stack.
(target_auxv_search, fprint_target_auxv): Adjust.
(info_auxv_command): Adjust to use target_stack.
* auxv.h (target_auxv_parse): Remove 'ops' parameter.
* exceptions.c (print_flush): Handle a NULL target_stack.
* regcache.c (target_ops_no_register): Refactor as class with
virtual methods.
* exec.c (exec_target): New class.
(exec_ops): Now an exec_target.
(exec_open, exec_close_1, exec_get_section_table)
(exec_xfer_partial, exec_files_info, exec_has_memory)
(exec_make_note_section): Refactor as exec_target methods.
(exec_file_clear, ignore, exec_remove_breakpoint, init_exec_ops):
Delete.
(exec_target::find_memory_regions): New.
(_initialize_exec): Don't call init_exec_ops.
* gdbcore.h (exec_file_clear): Delete.
* corefile.c (core_target): Delete.
(core_file_command): Adjust.
* corelow.c (core_target): New class.
(the_core_target): New.
(core_close): Remove target_ops parameter.
(core_close_cleanup): Adjust.
(core_target::close): New.
(core_open, core_detach, get_core_registers, core_files_info)
(core_xfer_partial, core_thread_alive, core_read_description)
(core_pid_to_str, core_thread_name, core_has_memory)
(core_has_stack, core_has_registers, core_info_proc): Rework as
core_target methods.
(ignore, core_remove_breakpoint, init_core_ops): Delete.
(_initialize_corelow): Initialize the_core_target.
* gdbcore.h (core_target): Delete.
(the_core_target): New.
* ctf.c: (ctf_target): New class.
(ctf_ops): Now a ctf_target.
(ctf_open, ctf_close, ctf_files_info, ctf_fetch_registers)
(ctf_xfer_partial, ctf_get_trace_state_variable_value)
(ctf_trace_find, ctf_traceframe_info): Refactor as ctf_target
methods.
(init_ctf_ops): Delete.
(_initialize_ctf): Don't call it.
* tracefile-tfile.c (tfile_target): New class.
(tfile_ops): Now a tfile_target.
(tfile_open, tfile_close, tfile_files_info)
(tfile_get_tracepoint_status, tfile_trace_find)
(tfile_fetch_registers, tfile_xfer_partial)
(tfile_get_trace_state_variable_value, tfile_traceframe_info):
Refactor as tfile_target methods.
(tfile_xfer_partial_features): Remove target_ops parameter.
(init_tfile_ops): Delete.
(_initialize_tracefile_tfile): Don't call it.
* tracefile.c (tracefile_has_all_memory, tracefile_has_memory)
(tracefile_has_stack, tracefile_has_registers)
(tracefile_thread_alive, tracefile_get_trace_status): Refactor as
tracefile_target methods.
(init_tracefile_ops): Delete.
(tracefile_target::tracefile_target): New.
* tracefile.h: Include "target.h".
(tracefile_target): New class.
(init_tracefile_ops): Delete.
* spu-multiarch.c (spu_multiarch_target): New class.
(spu_ops): Now a spu_multiarch_target.
(spu_thread_architecture, spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Refactor as
spu_multiarch_target methods.
(init_spu_ops): Delete.
(_initialize_spu_multiarch): Remove references to init_spu_ops,
complete_target_initialization.
* ravenscar-thread.c (ravenscar_thread_target): New class.
(ravenscar_ops): Now a ravenscar_thread_target.
(ravenscar_resume, ravenscar_wait, ravenscar_update_thread_list)
(ravenscar_thread_alive, ravenscar_pid_to_str)
(ravenscar_fetch_registers, ravenscar_store_registers)
(ravenscar_prepare_to_store, ravenscar_stopped_by_sw_breakpoint)
(ravenscar_stopped_by_hw_breakpoint)
(ravenscar_stopped_by_watchpoint, ravenscar_stopped_data_address)
(ravenscar_mourn_inferior, ravenscar_core_of_thread)
(ravenscar_get_ada_task_ptid): Refactor as ravenscar_thread_target
methods.
(init_ravenscar_thread_ops): Delete.
(_initialize_ravenscar): Remove references to
init_ravenscar_thread_ops and complete_target_initialization.
* bsd-uthread.c (bsd_uthread_ops_hack): Delete.
(bsd_uthread_target): New class.
(bsd_uthread_ops): Now a bsd_uthread_target.
(bsd_uthread_activate): Adjust to refer to bsd_uthread_ops.
(bsd_uthread_close, bsd_uthread_mourn_inferior)
(bsd_uthread_fetch_registers, bsd_uthread_store_registers)
(bsd_uthread_wait, bsd_uthread_resume, bsd_uthread_thread_alive)
(bsd_uthread_update_thread_list, bsd_uthread_extra_thread_info)
(bsd_uthread_pid_to_str): Refactor as bsd_uthread_target methods.
(bsd_uthread_target): Delete function.
(_initialize_bsd_uthread): Remove reference to
complete_target_initialization.
* bfd-target.c (target_bfd_data): Delete. Fields folded into ...
(target_bfd): ... this new class.
(target_bfd_xfer_partial, target_bfd_get_section_table)
(target_bfd_close): Refactor as target_bfd methods.
(target_bfd::~target_bfd): New.
(target_bfd_reopen): Adjust.
(target_bfd::close): New.
* record-btrace.c (record_btrace_target): New class.
(record_btrace_ops): Now a record_btrace_target.
(record_btrace_open, record_btrace_stop_recording)
(record_btrace_disconnect, record_btrace_close)
(record_btrace_async, record_btrace_info)
(record_btrace_insn_history, record_btrace_insn_history_range)
(record_btrace_insn_history_from, record_btrace_call_history)
(record_btrace_call_history_range)
(record_btrace_call_history_from, record_btrace_record_method)
(record_btrace_is_replaying, record_btrace_will_replay)
(record_btrace_xfer_partial, record_btrace_insert_breakpoint)
(record_btrace_remove_breakpoint, record_btrace_fetch_registers)
(record_btrace_store_registers, record_btrace_prepare_to_store)
(record_btrace_to_get_unwinder)
(record_btrace_to_get_tailcall_unwinder, record_btrace_resume)
(record_btrace_commit_resume, record_btrace_wait)
(record_btrace_stop, record_btrace_can_execute_reverse)
(record_btrace_stopped_by_sw_breakpoint)
(record_btrace_supports_stopped_by_sw_breakpoint)
(record_btrace_stopped_by_hw_breakpoint)
(record_btrace_supports_stopped_by_hw_breakpoint)
(record_btrace_update_thread_list, record_btrace_thread_alive)
(record_btrace_goto_begin, record_btrace_goto_end)
(record_btrace_goto, record_btrace_stop_replaying_all)
(record_btrace_execution_direction)
(record_btrace_prepare_to_generate_core)
(record_btrace_done_generating_core): Refactor as
record_btrace_target methods.
(init_record_btrace_ops): Delete.
(_initialize_record_btrace): Remove reference to
init_record_btrace_ops.
* record-full.c (RECORD_FULL_IS_REPLAY): Adjust to always refer to
the execution_direction global.
(record_full_base_target, record_full_target)
(record_full_core_target): New classes.
(record_full_ops): Now a record_full_target.
(record_full_core_ops): Now a record_full_core_target.
(record_full_target::detach, record_full_target::disconnect)
(record_full_core_target::disconnect)
(record_full_target::mourn_inferior, record_full_target::kill):
New.
(record_full_open, record_full_close, record_full_async): Refactor
as methods of the record_full_base_target class.
(record_full_resume, record_full_commit_resume): Refactor
as methods of the record_full_target class.
(record_full_wait, record_full_stopped_by_watchpoint)
(record_full_stopped_data_address)
(record_full_stopped_by_sw_breakpoint)
(record_full_supports_stopped_by_sw_breakpoint)
(record_full_stopped_by_hw_breakpoint)
(record_full_supports_stopped_by_hw_breakpoint): Refactor as
methods of the record_full_base_target class.
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint):
Refactor as methods of the record_full_target class.
(record_full_can_execute_reverse, record_full_get_bookmark)
(record_full_goto_bookmark, record_full_execution_direction)
(record_full_record_method, record_full_info, record_full_delete)
(record_full_is_replaying, record_full_will_replay)
(record_full_goto_begin, record_full_goto_end, record_full_goto)
(record_full_stop_replaying): Refactor as methods of the
record_full_base_target class.
(record_full_core_resume, record_full_core_kill)
(record_full_core_fetch_registers)
(record_full_core_prepare_to_store)
(record_full_core_store_registers, record_full_core_xfer_partial)
(record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint)
(record_full_core_has_execution): Refactor
as methods of the record_full_core_target class.
(record_full_base_target::supports_delete_record): New.
(init_record_full_ops): Delete.
(init_record_full_core_ops): Delete.
(record_full_save): Refactor as method of the
record_full_base_target class.
(_initialize_record_full): Remove references to
init_record_full_ops and init_record_full_core_ops.
* remote.c (remote_target, extended_remote_target): New classes.
(remote_ops): Now a remote_target.
(extended_remote_ops): Now an extended_remote_target.
(remote_insert_fork_catchpoint, remote_remove_fork_catchpoint)
(remote_insert_vfork_catchpoint, remote_remove_vfork_catchpoint)
(remote_insert_exec_catchpoint, remote_remove_exec_catchpoint)
(remote_pass_signals, remote_set_syscall_catchpoint)
(remote_program_signals, )
(remote_thread_always_alive): Remove target_ops parameter.
(remote_thread_alive, remote_thread_name)
(remote_update_thread_list, remote_threads_extra_info)
(remote_static_tracepoint_marker_at)
(remote_static_tracepoint_markers_by_strid)
(remote_get_ada_task_ptid, remote_close, remote_start_remote)
(remote_open): Refactor as methods of remote_target.
(extended_remote_open, extended_remote_detach)
(extended_remote_attach, extended_remote_post_attach):
(extended_remote_supports_disable_randomization)
(extended_remote_create_inferior): : Refactor as method of
extended_remote_target.
(remote_set_permissions, remote_open_1, remote_detach)
(remote_follow_fork, remote_follow_exec, remote_disconnect)
(remote_resume, remote_commit_resume, remote_stop)
(remote_interrupt, remote_pass_ctrlc, remote_terminal_inferior)
(remote_terminal_ours, remote_wait, remote_fetch_registers)
(remote_prepare_to_store, remote_store_registers)
(remote_flash_erase, remote_flash_done, remote_files_info)
(remote_kill, remote_mourn, remote_insert_breakpoint)
(remote_remove_breakpoint, remote_insert_watchpoint)
(remote_watchpoint_addr_within_range)
(remote_remove_watchpoint, remote_region_ok_for_hw_watchpoint)
(remote_check_watch_resources, remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint)
(remote_stopped_by_watchpoint, remote_stopped_data_address)
(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
(remote_verify_memory): Refactor as methods of remote_target.
(remote_write_qxfer, remote_read_qxfer): Remove target_ops
parameter.
(remote_xfer_partial, remote_get_memory_xfer_limit)
(remote_search_memory, remote_rcmd, remote_memory_map)
(remote_pid_to_str, remote_get_thread_local_address)
(remote_get_tib_address, remote_read_description): Refactor as
methods of remote_target.
(remote_target::fileio_open, remote_target::fileio_pwrite)
(remote_target::fileio_pread, remote_target::fileio_close): New.
(remote_hostio_readlink, remote_hostio_fstat)
(remote_filesystem_is_local, remote_can_execute_reverse)
(remote_supports_non_stop, remote_supports_disable_randomization)
(remote_supports_multi_process, remote_supports_cond_breakpoints)
(remote_supports_enable_disable_tracepoint)
(remote_supports_string_tracing)
(remote_can_run_breakpoint_commands, remote_trace_init)
(remote_download_tracepoint, remote_can_download_tracepoint)
(remote_download_trace_state_variable, remote_enable_tracepoint)
(remote_disable_tracepoint, remote_trace_set_readonly_regions)
(remote_trace_start, remote_get_trace_status)
(remote_get_tracepoint_status, remote_trace_stop)
(remote_trace_find, remote_get_trace_state_variable_value)
(remote_save_trace_data, remote_get_raw_trace_data)
(remote_set_disconnected_tracing, remote_core_of_thread)
(remote_set_circular_trace_buffer, remote_traceframe_info)
(remote_get_min_fast_tracepoint_insn_len)
(remote_set_trace_buffer_size, remote_set_trace_notes)
(remote_use_agent, remote_can_use_agent, remote_enable_btrace)
(remote_disable_btrace, remote_teardown_btrace)
(remote_read_btrace, remote_btrace_conf)
(remote_augmented_libraries_svr4_read, remote_load)
(remote_pid_to_exec_file, remote_can_do_single_step)
(remote_execution_direction, remote_thread_handle_to_thread_info):
Refactor as methods of remote_target.
(init_remote_ops, init_extended_remote_ops): Delete.
(remote_can_async_p, remote_is_async_p, remote_async)
(remote_thread_events, remote_upload_tracepoints)
(remote_upload_trace_state_variables): Refactor as methods of
remote_target.
(_initialize_remote): Remove references to init_remote_ops and
init_extended_remote_ops.
* remote-sim.c (gdbsim_target): New class.
(gdbsim_fetch_register, gdbsim_store_register, gdbsim_kill)
(gdbsim_load, gdbsim_create_inferior, gdbsim_open, gdbsim_close)
(gdbsim_detach, gdbsim_resume, gdbsim_interrupt)
(gdbsim_wait, gdbsim_prepare_to_store, gdbsim_xfer_partial)
(gdbsim_files_info, gdbsim_mourn_inferior, gdbsim_thread_alive)
(gdbsim_pid_to_str, gdbsim_has_all_memory, gdbsim_has_memory):
Refactor as methods of gdbsim_target.
(gdbsim_ops): Now a gdbsim_target.
(init_gdbsim_ops): Delete.
(gdbsim_cntrl_c): Adjust.
(_initialize_remote_sim): Remove reference to init_gdbsim_ops.
* amd64-linux-nat.c (amd64_linux_nat_target): New class.
(the_amd64_linux_nat_target): New.
(amd64_linux_fetch_inferior_registers)
(amd64_linux_store_inferior_registers): Refactor as methods of
amd64_linux_nat_target.
(_initialize_amd64_linux_nat): Adjust. Set linux_target.
* i386-linux-nat.c: Don't include "linux-nat.h".
(i386_linux_nat_target): New class.
(the_i386_linux_nat_target): New.
(i386_linux_fetch_inferior_registers)
(i386_linux_store_inferior_registers, i386_linux_resume): Refactor
as methods of i386_linux_nat_target.
(_initialize_i386_linux_nat): Adjust. Set linux_target.
* inf-child.c (inf_child_ops): Delete.
(inf_child_fetch_inferior_registers)
(inf_child_store_inferior_registers): Delete.
(inf_child_post_attach, inf_child_prepare_to_store): Refactor as
methods of inf_child_target.
(inf_child_target::supports_terminal_ours)
(inf_child_target::terminal_init)
(inf_child_target::terminal_inferior)
(inf_child_target::terminal_ours_for_output)
(inf_child_target::terminal_ours, inf_child_target::interrupt)
(inf_child_target::pass_ctrlc, inf_child_target::terminal_info):
New.
(inf_child_open, inf_child_disconnect, inf_child_close)
(inf_child_mourn_inferior, inf_child_maybe_unpush_target)
(inf_child_post_startup_inferior, inf_child_can_run)
(inf_child_pid_to_exec_file): Refactor as methods of
inf_child_target.
(inf_child_follow_fork): Delete.
(inf_child_target::can_create_inferior)
(inf_child_target::can_attach): New.
(inf_child_target::has_all_memory, inf_child_target::has_memory)
(inf_child_target::has_stack, inf_child_target::has_registers)
(inf_child_target::has_execution): New.
(inf_child_fileio_open, inf_child_fileio_pwrite)
(inf_child_fileio_pread, inf_child_fileio_fstat)
(inf_child_fileio_close, inf_child_fileio_unlink)
(inf_child_fileio_readlink, inf_child_use_agent)
(inf_child_can_use_agent): Refactor as methods of
inf_child_target.
(return_zero, inf_child_target): Delete.
(inf_child_target::inf_child_target): New.
* inf-child.h: Include "target.h".
(inf_child_target): Delete function prototype.
(inf_child_target): New class.
(inf_child_open_target, inf_child_mourn_inferior)
(inf_child_maybe_unpush_target): Delete.
* inf-ptrace.c (inf_ptrace_target::~inf_ptrace_target): New.
(inf_ptrace_follow_fork, inf_ptrace_insert_fork_catchpoint)
(inf_ptrace_remove_fork_catchpoint, inf_ptrace_create_inferior)
(inf_ptrace_post_startup_inferior, inf_ptrace_mourn_inferior)
(inf_ptrace_attach, inf_ptrace_post_attach, inf_ptrace_detach)
(inf_ptrace_detach_success, inf_ptrace_kill, inf_ptrace_resume)
(inf_ptrace_wait, inf_ptrace_xfer_partial)
(inf_ptrace_thread_alive, inf_ptrace_files_info)
(inf_ptrace_pid_to_str, inf_ptrace_auxv_parse): Refactor as
methods of inf_ptrace_target.
(inf_ptrace_target): Delete function.
* inf-ptrace.h: Include "inf-child.h".
(inf_ptrace_target): Delete function declaration.
(inf_ptrace_target): New class.
(inf_ptrace_trad_target, inf_ptrace_detach_success): Delete.
* linux-nat.c (linux_target): New.
(linux_ops, linux_ops_saved, super_xfer_partial): Delete.
(linux_nat_target::~linux_nat_target): New.
(linux_child_post_attach, linux_child_post_startup_inferior)
(linux_child_follow_fork, linux_child_insert_fork_catchpoint)
(linux_child_remove_fork_catchpoint)
(linux_child_insert_vfork_catchpoint)
(linux_child_remove_vfork_catchpoint)
(linux_child_insert_exec_catchpoint)
(linux_child_remove_exec_catchpoint)
(linux_child_set_syscall_catchpoint, linux_nat_pass_signals)
(linux_nat_create_inferior, linux_nat_attach, linux_nat_detach)
(linux_nat_resume, linux_nat_stopped_by_watchpoint)
(linux_nat_stopped_data_address)
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint, linux_nat_wait)
(linux_nat_kill, linux_nat_mourn_inferior)
(linux_nat_xfer_partial, linux_nat_thread_alive)
(linux_nat_update_thread_list, linux_nat_pid_to_str)
(linux_nat_thread_name, linux_child_pid_to_exec_file)
(linux_child_static_tracepoint_markers_by_strid)
(linux_nat_is_async_p, linux_nat_can_async_p)
(linux_nat_supports_non_stop, linux_nat_always_non_stop_p)
(linux_nat_supports_multi_process)
(linux_nat_supports_disable_randomization, linux_nat_async)
(linux_nat_stop, linux_nat_close, linux_nat_thread_address_space)
(linux_nat_core_of_thread, linux_nat_filesystem_is_local)
(linux_nat_fileio_open, linux_nat_fileio_readlink)
(linux_nat_fileio_unlink, linux_nat_thread_events): Refactor as
methods of linux_nat_target.
(linux_nat_wait_1, linux_xfer_siginfo, linux_proc_xfer_partial)
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Remove target_ops
parameter.
(check_stopped_by_watchpoint): Adjust.
(linux_xfer_partial): Delete.
(linux_target_install_ops, linux_target, linux_nat_add_target):
Delete.
(linux_nat_target::linux_nat_target): New.
* linux-nat.h: Include "inf-ptrace.h".
(linux_nat_target): New.
(linux_target, linux_target_install_ops, linux_nat_add_target):
Delete function declarations.
(linux_target): Declare global.
* linux-thread-db.c (thread_db_target): New.
(thread_db_target::thread_db_target): New.
(thread_db_ops): Delete.
(the_thread_db_target): New.
(thread_db_detach, thread_db_wait, thread_db_mourn_inferior)
(thread_db_update_thread_list, thread_db_pid_to_str)
(thread_db_extra_thread_info)
(thread_db_thread_handle_to_thread_info)
(thread_db_get_thread_local_address, thread_db_get_ada_task_ptid)
(thread_db_resume): Refactor as methods of thread_db_target.
(init_thread_db_ops): Delete.
(_initialize_thread_db): Remove reference to init_thread_db_ops.
* x86-linux-nat.c: Don't include "linux-nat.h".
(super_post_startup_inferior): Delete.
(x86_linux_nat_target::~x86_linux_nat_target): New.
(x86_linux_child_post_startup_inferior)
(x86_linux_read_description, x86_linux_enable_btrace)
(x86_linux_disable_btrace, x86_linux_teardown_btrace)
(x86_linux_read_btrace, x86_linux_btrace_conf): Refactor as
methods of x86_linux_nat_target.
(x86_linux_create_target): Delete. Bits folded ...
(x86_linux_add_target): ... here. Now takes a linux_nat_target
pointer.
* x86-linux-nat.h: Include "linux-nat.h" and "x86-nat.h".
(x86_linux_nat_target): New class.
(x86_linux_create_target): Delete.
(x86_linux_add_target): Now takes a linux_nat_target pointer.
* x86-nat.c (x86_insert_watchpoint, x86_remove_watchpoint)
(x86_region_ok_for_watchpoint, x86_stopped_data_address)
(x86_stopped_by_watchpoint, x86_insert_hw_breakpoint)
(x86_remove_hw_breakpoint, x86_can_use_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): Remove target_ops parameter and
make extern.
(x86_use_watchpoints): Delete.
* x86-nat.h: Include "breakpoint.h" and "target.h".
(x86_use_watchpoints): Delete.
(x86_can_use_hw_breakpoint, x86_region_ok_for_hw_watchpoint)
(x86_stopped_by_watchpoint, x86_stopped_data_address)
(x86_insert_watchpoint, x86_remove_watchpoint)
(x86_insert_hw_breakpoint, x86_remove_hw_breakpoint)
(x86_stopped_by_hw_breakpoint): New declarations.
(x86_nat_target): New template class.
* ppc-linux-nat.c (ppc_linux_nat_target): New class.
(the_ppc_linux_nat_target): New.
(ppc_linux_fetch_inferior_registers)
(ppc_linux_can_use_hw_breakpoint)
(ppc_linux_region_ok_for_hw_watchpoint)
(ppc_linux_ranged_break_num_registers)
(ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
(ppc_linux_insert_mask_watchpoint)
(ppc_linux_remove_mask_watchpoint)
(ppc_linux_can_accel_watchpoint_condition)
(ppc_linux_insert_watchpoint, ppc_linux_remove_watchpoint)
(ppc_linux_stopped_data_address, ppc_linux_stopped_by_watchpoint)
(ppc_linux_watchpoint_addr_within_range)
(ppc_linux_masked_watch_num_registers)
(ppc_linux_store_inferior_registers, ppc_linux_auxv_parse)
(ppc_linux_read_description): Refactor as methods of
ppc_linux_nat_target.
(_initialize_ppc_linux_nat): Adjust. Set linux_target.
* procfs.c (procfs_xfer_partial): Delete forward declaration.
(procfs_target): New class.
(the_procfs_target): New.
(procfs_target): Delete function.
(procfs_auxv_parse, procfs_attach, procfs_detach)
(procfs_fetch_registers, procfs_store_registers, procfs_wait)
(procfs_xfer_partial, procfs_resume, procfs_pass_signals)
(procfs_files_info, procfs_kill_inferior, procfs_mourn_inferior)
(procfs_create_inferior, procfs_update_thread_list)
(procfs_thread_alive, procfs_pid_to_str)
(procfs_can_use_hw_breakpoint, procfs_stopped_by_watchpoint)
(procfs_stopped_data_address, procfs_insert_watchpoint)
(procfs_remove_watchpoint, procfs_region_ok_for_hw_watchpoint)
(proc_find_memory_regions, procfs_info_proc)
(procfs_make_note_section): Refactor as methods of procfs_target.
(_initialize_procfs): Adjust.
* sol-thread.c (sol_thread_target): New class.
(sol_thread_ops): Now a sol_thread_target.
(sol_thread_detach, sol_thread_resume, sol_thread_wait)
(sol_thread_fetch_registers, sol_thread_store_registers)
(sol_thread_xfer_partial, sol_thread_mourn_inferior)
(sol_thread_alive, solaris_pid_to_str, sol_update_thread_list)
(sol_get_ada_task_ptid): Refactor as methods of sol_thread_target.
(init_sol_thread_ops): Delete.
(_initialize_sol_thread): Adjust. Remove references to
init_sol_thread_ops and complete_target_initialization.
* windows-nat.c (windows_nat_target): New class.
(windows_fetch_inferior_registers)
(windows_store_inferior_registers, windows_resume, windows_wait)
(windows_attach, windows_detach, windows_pid_to_exec_file)
(windows_files_info, windows_create_inferior)
(windows_mourn_inferior, windows_interrupt, windows_kill_inferior)
(windows_close, windows_pid_to_str, windows_xfer_partial)
(windows_get_tib_address, windows_get_ada_task_ptid)
(windows_thread_name, windows_thread_alive): Refactor as
windows_nat_target methods.
(do_initial_windows_stuff): Adjust.
(windows_target): Delete function.
(_initialize_windows_nat): Adjust.
* darwin-nat.c (darwin_resume, darwin_wait_to, darwin_interrupt)
(darwin_mourn_inferior, darwin_kill_inferior)
(darwin_create_inferior, darwin_attach, darwin_detach)
(darwin_pid_to_str, darwin_thread_alive, darwin_xfer_partial)
(darwin_pid_to_exec_file, darwin_get_ada_task_ptid)
(darwin_supports_multi_process): Refactor as darwin_nat_target
methods.
(darwin_resume_to, darwin_files_info): Delete.
(_initialize_darwin_inferior): Rename to ...
(_initialize_darwin_nat): ... this. Adjust to C++ification.
* darwin-nat.h: Include "inf-child.h".
(darwin_nat_target): New class.
(darwin_complete_target): Delete.
* i386-darwin-nat.c (i386_darwin_nat_target): New class.
(darwin_target): New.
(i386_darwin_fetch_inferior_registers)
(i386_darwin_store_inferior_registers): Refactor as methods of
darwin_nat_target.
(darwin_complete_target): Delete, with ...
(_initialize_i386_darwin_nat): ... bits factored out here.
* alpha-linux-nat.c (alpha_linux_nat_target): New class.
(the_alpha_linux_nat_target): New.
(alpha_linux_register_u_offset): Refactor as
alpha_linux_nat_target method.
(_initialize_alpha_linux_nat): Adjust.
* linux-nat-trad.c (inf_ptrace_register_u_offset): Delete.
(inf_ptrace_fetch_register, inf_ptrace_fetch_registers)
(inf_ptrace_store_register, inf_ptrace_store_registers): Refact as
methods of linux_nat_trad_target.
(linux_trad_target): Delete.
* linux-nat-trad.h (linux_trad_target): Delete function.
(linux_nat_trad_target): New class.
* mips-linux-nat.c (mips_linux_nat_target): New class.
(super_fetch_registers, super_store_registers, super_close):
Delete.
(the_mips_linux_nat_target): New.
(mips64_linux_regsets_fetch_registers)
(mips64_linux_regsets_store_registers)
(mips64_linux_fetch_registers, mips64_linux_store_registers)
(mips_linux_register_u_offset, mips_linux_read_description)
(mips_linux_can_use_hw_breakpoint)
(mips_linux_stopped_by_watchpoint)
(mips_linux_stopped_data_address)
(mips_linux_region_ok_for_hw_watchpoint)
(mips_linux_insert_watchpoint, mips_linux_remove_watchpoint)
(mips_linux_close): Refactor as methods of mips_linux_nat.
(_initialize_mips_linux_nat): Adjust to C++ification.
* aix-thread.c (aix_thread_target): New class.
(aix_thread_ops): Now an aix_thread_target.
(aix_thread_detach, aix_thread_resume, aix_thread_wait)
(aix_thread_fetch_registers, aix_thread_store_registers)
(aix_thread_xfer_partial, aix_thread_mourn_inferior)
(aix_thread_thread_alive, aix_thread_pid_to_str)
(aix_thread_extra_thread_info, aix_thread_get_ada_task_ptid):
Refactor as methods of aix_thread_target.
(init_aix_thread_ops): Delete.
(_initialize_aix_thread): Remove references to init_aix_thread_ops
and complete_target_initialization.
* rs6000-nat.c (rs6000_xfer_shared_libraries): Delete.
(rs6000_nat_target): New class.
(the_rs6000_nat_target): New.
(rs6000_fetch_inferior_registers, rs6000_store_inferior_registers)
(rs6000_xfer_partial, rs6000_wait, rs6000_create_inferior)
(rs6000_xfer_shared_libraries): Refactor as rs6000_nat_target methods.
(super_create_inferior): Delete.
(_initialize_rs6000_nat): Adjust to C++ification.
* arm-linux-nat.c (arm_linux_nat_target): New class.
(the_arm_linux_nat_target): New.
(arm_linux_fetch_inferior_registers)
(arm_linux_store_inferior_registers, arm_linux_read_description)
(arm_linux_can_use_hw_breakpoint, arm_linux_insert_hw_breakpoint)
(arm_linux_remove_hw_breakpoint)
(arm_linux_region_ok_for_hw_watchpoint)
(arm_linux_insert_watchpoint, arm_linux_remove_watchpoint)
(arm_linux_stopped_data_address, arm_linux_stopped_by_watchpoint)
(arm_linux_watchpoint_addr_within_range): Refactor as methods of
arm_linux_nat_target.
(_initialize_arm_linux_nat): Adjust to C++ification.
* aarch64-linux-nat.c (aarch64_linux_nat_target): New class.
(the_aarch64_linux_nat_target): New.
(aarch64_linux_fetch_inferior_registers)
(aarch64_linux_store_inferior_registers)
(aarch64_linux_child_post_startup_inferior)
(aarch64_linux_read_description)
(aarch64_linux_can_use_hw_breakpoint)
(aarch64_linux_insert_hw_breakpoint)
(aarch64_linux_remove_hw_breakpoint)
(aarch64_linux_insert_watchpoint, aarch64_linux_remove_watchpoint)
(aarch64_linux_region_ok_for_hw_watchpoint)
(aarch64_linux_stopped_data_address)
(aarch64_linux_stopped_by_watchpoint)
(aarch64_linux_watchpoint_addr_within_range)
(aarch64_linux_can_do_single_step): Refactor as methods of
aarch64_linux_nat_target.
(super_post_startup_inferior): Delete.
(_initialize_aarch64_linux_nat): Adjust to C++ification.
* hppa-linux-nat.c (hppa_linux_nat_target): New class.
(the_hppa_linux_nat_target): New.
(hppa_linux_fetch_inferior_registers)
(hppa_linux_store_inferior_registers): Refactor as methods of
hppa_linux_nat_target.
(_initialize_hppa_linux_nat): Adjust to C++ification.
* ia64-linux-nat.c (ia64_linux_nat_target): New class.
(the_ia64_linux_nat_target): New.
(ia64_linux_insert_watchpoint, ia64_linux_remove_watchpoint)
(ia64_linux_stopped_data_address)
(ia64_linux_stopped_by_watchpoint, ia64_linux_fetch_registers)
(ia64_linux_store_registers, ia64_linux_xfer_partial): Refactor as
ia64_linux_nat_target methods.
(super_xfer_partial): Delete.
(_initialize_ia64_linux_nat): Adjust to C++ification.
* m32r-linux-nat.c (m32r_linux_nat_target): New class.
(the_m32r_linux_nat_target): New.
(m32r_linux_fetch_inferior_registers)
(m32r_linux_store_inferior_registers): Refactor as
m32r_linux_nat_target methods.
(_initialize_m32r_linux_nat): Adjust to C++ification.
* m68k-linux-nat.c (m68k_linux_nat_target): New class.
(the_m68k_linux_nat_target): New.
(m68k_linux_fetch_inferior_registers)
(m68k_linux_store_inferior_registers): Refactor as
m68k_linux_nat_target methods.
(_initialize_m68k_linux_nat): Adjust to C++ification.
* s390-linux-nat.c (s390_linux_nat_target): New class.
(the_s390_linux_nat_target): New.
(s390_linux_fetch_inferior_registers)
(s390_linux_store_inferior_registers, s390_stopped_by_watchpoint)
(s390_insert_watchpoint, s390_remove_watchpoint)
(s390_can_use_hw_breakpoint, s390_insert_hw_breakpoint)
(s390_remove_hw_breakpoint, s390_region_ok_for_hw_watchpoint)
(s390_auxv_parse, s390_read_description): Refactor as methods of
s390_linux_nat_target.
(_initialize_s390_nat): Adjust to C++ification.
* sparc-linux-nat.c (sparc_linux_nat_target): New class.
(the_sparc_linux_nat_target): New.
(_initialize_sparc_linux_nat): Adjust to C++ification.
* sparc-nat.c (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers): Remove target_ops parameter.
* sparc64-linux-nat.c (sparc64_linux_nat_target): New class.
(the_sparc64_linux_nat_target): New.
(_initialize_sparc64_linux_nat): Adjust to C++ification.
* spu-linux-nat.c (spu_linux_nat_target): New class.
(the_spu_linux_nat_target): New.
(spu_child_post_startup_inferior, spu_child_post_attach)
(spu_child_wait, spu_fetch_inferior_registers)
(spu_store_inferior_registers, spu_xfer_partial)
(spu_can_use_hw_breakpoint): Refactor as spu_linux_nat_target
methods.
(_initialize_spu_nat): Adjust to C++ification.
* tilegx-linux-nat.c (tilegx_linux_nat_target): New class.
(the_tilegx_linux_nat_target): New.
(fetch_inferior_registers, store_inferior_registers):
Refactor as methods.
(_initialize_tile_linux_nat): Adjust to C++ification.
* xtensa-linux-nat.c (xtensa_linux_nat_target): New class.
(the_xtensa_linux_nat_target): New.
(xtensa_linux_fetch_inferior_registers)
(xtensa_linux_store_inferior_registers): Refactor as
xtensa_linux_nat_target methods.
(_initialize_xtensa_linux_nat): Adjust to C++ification.
* fbsd-nat.c (USE_SIGTRAP_SIGINFO): Delete.
(fbsd_pid_to_exec_file, fbsd_find_memory_regions)
(fbsd_find_memory_regions, fbsd_info_proc, fbsd_xfer_partial)
(fbsd_thread_alive, fbsd_pid_to_str, fbsd_thread_name)
(fbsd_update_thread_list, fbsd_resume, fbsd_wait)
(fbsd_stopped_by_sw_breakpoint)
(fbsd_supports_stopped_by_sw_breakpoint, fbsd_follow_fork)
(fbsd_insert_fork_catchpoint, fbsd_remove_fork_catchpoint)
(fbsd_insert_vfork_catchpoint, fbsd_remove_vfork_catchpoint)
(fbsd_post_startup_inferior, fbsd_post_attach)
(fbsd_insert_exec_catchpoint, fbsd_remove_exec_catchpoint)
(fbsd_set_syscall_catchpoint)
(super_xfer_partial, super_resume, super_wait)
(fbsd_supports_stopped_by_hw_breakpoint): Delete.
(fbsd_handle_debug_trap): Remove target_ops parameter.
(fbsd_nat_add_target): Delete.
* fbsd-nat.h: Include "inf-ptrace.h".
(fbsd_nat_add_target): Delete.
(USE_SIGTRAP_SIGINFO): Define.
(fbsd_nat_target): New class.
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers)
(amd64bsd_store_inferior_registers): Remove target_ops parameter.
(amd64bsd_target): Delete.
* amd64-bsd-nat.h: New file.
* amd64-fbsd-nat.c: Include "amd64-bsd-nat.h" instead of
"x86-bsd-nat.h".
(amd64_fbsd_nat_target): New class.
(the_amd64_fbsd_nat_target): New.
(amd64fbsd_read_description): Refactor as method of
amd64_fbsd_nat_target.
(amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_amd64fbsd_nat): Adjust to C++ification.
* amd64-nat.h (amd64bsd_target): Delete function declaration.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Remove target_ops parameter.
(i386bsd_target): Delete.
* i386-bsd-nat.h (i386bsd_target): Delete function declaration.
(i386bsd_fetch_inferior_registers)
(i386bsd_store_inferior_registers): Declare.
(i386_bsd_nat_target): New class.
* i386-fbsd-nat.c (i386_fbsd_nat_target): New class.
(the_i386_fbsd_nat_target): New.
(i386fbsd_resume, i386fbsd_read_description): Refactor as
i386_fbsd_nat_target methods.
(i386_fbsd_nat_target::supports_stopped_by_hw_breakpoint): New.
(_initialize_i386fbsd_nat): Adjust to C++ification.
* x86-bsd-nat.c (super_mourn_inferior): Delete.
(x86bsd_mourn_inferior, x86bsd_target): Delete.
(_initialize_x86_bsd_nat): Adjust to C++ification.
* x86-bsd-nat.h: Include "x86-nat.h".
(x86bsd_target): Delete declaration.
(x86bsd_nat_target): New class.
* aarch64-fbsd-nat.c (aarch64_fbsd_nat_target): New class.
(the_aarch64_fbsd_nat_target): New.
(aarch64_fbsd_fetch_inferior_registers)
(aarch64_fbsd_store_inferior_registers): Refactor as methods of
aarch64_fbsd_nat_target.
(_initialize_aarch64_fbsd_nat): Adjust to C++ification.
* alpha-bsd-nat.c (alpha_bsd_nat_target): New class.
(the_alpha_bsd_nat_target): New.
(alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Refactor as
alpha_bsd_nat_target methods.
(_initialize_alphabsd_nat): Refactor as methods of
alpha_bsd_nat_target.
* amd64-nbsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_nbsd_nat_target): New.
(_initialize_amd64nbsd_nat): Adjust to C++ification.
* amd64-obsd-nat.c: Include "amd64-bsd-nat.h".
(the_amd64_obsd_nat_target): New.
(_initialize_amd64obsd_nat): Adjust to C++ification.
* arm-fbsd-nat.c (arm_fbsd_nat_target): New.
(the_arm_fbsd_nat_target): New.
(arm_fbsd_fetch_inferior_registers)
(arm_fbsd_store_inferior_registers, arm_fbsd_read_description):
(_initialize_arm_fbsd_nat): Refactor as methods of
arm_fbsd_nat_target.
(_initialize_arm_fbsd_nat): Adjust to C++ification.
* arm-nbsd-nat.c (arm_netbsd_nat_target): New class.
(the_arm_netbsd_nat_target): New.
(armnbsd_fetch_registers, armnbsd_store_registers): Refactor as
arm_netbsd_nat_target.
(_initialize_arm_netbsd_nat): Adjust to C++ification.
* hppa-nbsd-nat.c (hppa_nbsd_nat_target): New class.
(the_hppa_nbsd_nat_target): New.
(hppanbsd_fetch_registers, hppanbsd_store_registers): Refactor as
hppa_nbsd_nat_target methods.
(_initialize_hppanbsd_nat): Adjust to C++ification.
* hppa-obsd-nat.c (hppa_obsd_nat_target): New class.
(the_hppa_obsd_nat_target): New.
(hppaobsd_fetch_registers, hppaobsd_store_registers): Refactor as
methods of hppa_obsd_nat_target.
(_initialize_hppaobsd_nat): Adjust to C++ification. Use
add_target.
* i386-nbsd-nat.c (the_i386_nbsd_nat_target): New.
(_initialize_i386nbsd_nat): Adjust to C++ification. Use
add_target.
* i386-obsd-nat.c (the_i386_obsd_nat_target): New.
(_initialize_i386obsd_nat): Use add_target.
* m68k-bsd-nat.c (m68k_bsd_nat_target): New class.
(the_m68k_bsd_nat_target): New.
(m68kbsd_fetch_inferior_registers)
(m68kbsd_store_inferior_registers): Refactor as methods of
m68k_bsd_nat_target.
(_initialize_m68kbsd_nat): Adjust to C++ification.
* mips-fbsd-nat.c (mips_fbsd_nat_target): New class.
(the_mips_fbsd_nat_target): New.
(mips_fbsd_fetch_inferior_registers)
(mips_fbsd_store_inferior_registers): Refactor as methods of
mips_fbsd_nat_target.
(_initialize_mips_fbsd_nat): Adjust to C++ification. Use
add_target.
* mips-nbsd-nat.c (mips_nbsd_nat_target): New class.
(the_mips_nbsd_nat_target): New.
(mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Refactor as methods of
mips_nbsd_nat_target.
(_initialize_mipsnbsd_nat): Adjust to C++ification.
* mips64-obsd-nat.c (mips64_obsd_nat_target): New class.
(the_mips64_obsd_nat_target): New.
(mips64obsd_fetch_inferior_registers)
(mips64obsd_store_inferior_registers): Refactor as methods of
mips64_obsd_nat_target.
(_initialize_mips64obsd_nat): Adjust to C++ification. Use
add_target.
* nbsd-nat.c (nbsd_pid_to_exec_file): Refactor as method of
nbsd_nat_target.
* nbsd-nat.h: Include "inf-ptrace.h".
(nbsd_nat_target): New class.
* obsd-nat.c (obsd_pid_to_str, obsd_update_thread_list)
(obsd_wait): Refactor as methods of obsd_nat_target.
(obsd_add_target): Delete.
* obsd-nat.h: Include "inf-ptrace.h".
(obsd_nat_target): New class.
* ppc-fbsd-nat.c (ppc_fbsd_nat_target): New class.
(the_ppc_fbsd_nat_target): New.
(ppcfbsd_fetch_inferior_registers)
(ppcfbsd_store_inferior_registers): Refactor as methods of
ppc_fbsd_nat_target.
(_initialize_ppcfbsd_nat): Adjust to C++ification. Use
add_target.
* ppc-nbsd-nat.c (ppc_nbsd_nat_target): New class.
(the_ppc_nbsd_nat_target): New.
(ppcnbsd_fetch_inferior_registers)
(ppcnbsd_store_inferior_registers): Refactor as methods of
ppc_nbsd_nat_target.
(_initialize_ppcnbsd_nat): Adjust to C++ification.
* ppc-obsd-nat.c (ppc_obsd_nat_target): New class.
(the_ppc_obsd_nat_target): New.
(ppcobsd_fetch_registers, ppcobsd_store_registers): Refactor as
methods of ppc_obsd_nat_target.
(_initialize_ppcobsd_nat): Adjust to C++ification. Use
add_target.
* sh-nbsd-nat.c (sh_nbsd_nat_target): New class.
(the_sh_nbsd_nat_target): New.
(shnbsd_fetch_inferior_registers)
(shnbsd_store_inferior_registers): Refactor as methods of
sh_nbsd_nat_target.
(_initialize_shnbsd_nat): Adjust to C++ification.
* sparc-nat.c (sparc_xfer_wcookie): Make extern.
(inf_ptrace_xfer_partial): Delete.
(sparc_xfer_partial, sparc_target): Delete.
* sparc-nat.h (sparc_fetch_inferior_registers)
(sparc_store_inferior_registers, sparc_xfer_wcookie): Declare.
(sparc_target): Delete function declaration.
(sparc_target): New template class.
* sparc-nbsd-nat.c (the_sparc_nbsd_nat_target): New.
(_initialize_sparcnbsd_nat): Adjust to C++ification.
* sparc64-fbsd-nat.c (the_sparc64_fbsd_nat_target): New.
(_initialize_sparc64fbsd_nat): Adjust to C++ification. Use
add_target.
* sparc64-nbsd-nat.c (the_sparc64_nbsd_nat_target): New.
(_initialize_sparc64nbsd_nat): Adjust to C++ification.
* sparc64-obsd-nat.c (the_sparc64_obsd_nat_target): New.
(_initialize_sparc64obsd_nat): Adjust to C++ification. Use
add_target.
* vax-bsd-nat.c (vax_bsd_nat_target): New class.
(the_vax_bsd_nat_target): New.
(vaxbsd_fetch_inferior_registers)
(vaxbsd_store_inferior_registers): Refactor as vax_bsd_nat_target
methods.
(_initialize_vaxbsd_nat): Adjust to C++ification.
* bsd-kvm.c (bsd_kvm_target): New class.
(bsd_kvm_ops): Now a bsd_kvm_target.
(bsd_kvm_open, bsd_kvm_close, bsd_kvm_xfer_partial)
(bsd_kvm_files_info, bsd_kvm_fetch_registers)
(bsd_kvm_thread_alive, bsd_kvm_pid_to_str): Refactor as methods of
bsd_kvm_target.
(bsd_kvm_return_one): Delete.
(bsd_kvm_add_target): Adjust to C++ification.
* nto-procfs.c (nto_procfs_target, nto_procfs_target_native)
(nto_procfs_target_procfs): New classes.
(procfs_open_1, procfs_thread_alive, procfs_update_thread_list)
(procfs_files_info, procfs_pid_to_exec_file, procfs_attach)
(procfs_post_attach, procfs_wait, procfs_fetch_registers)
(procfs_xfer_partial, procfs_detach, procfs_insert_breakpoint)
(procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
(procfs_remove_hw_breakpoint, procfs_resume)
(procfs_mourn_inferior, procfs_create_inferior, procfs_interrupt)
(procfs_kill_inferior, procfs_store_registers)
(procfs_pass_signals, procfs_pid_to_str, procfs_can_run): Refactor
as methods of nto_procfs_target.
(nto_procfs_ops): Now an nto_procfs_target_procfs.
(nto_native_ops): Delete.
(procfs_open, procfs_native_open): Delete.
(nto_native_ops): Now an nto_procfs_target_native.
(init_procfs_targets): Adjust to C++ification.
(procfs_can_use_hw_breakpoint, procfs_remove_hw_watchpoint)
(procfs_insert_hw_watchpoint, procfs_stopped_by_watchpoint):
Refactor as methods of nto_procfs_target.
* go32-nat.c (go32_nat_target): New class.
(the_go32_nat_target): New.
(go32_attach, go32_resume, go32_wait, go32_fetch_registers)
(go32_store_registers, go32_xfer_partial, go32_files_info)
(go32_kill_inferior, go32_create_inferior, go32_mourn_inferior)
(go32_terminal_init, go32_terminal_info, go32_terminal_inferior)
(go32_terminal_ours, go32_pass_ctrlc, go32_thread_alive)
(go32_pid_to_str): Refactor as methods of go32_nat_target.
(go32_target): Delete.
(_initialize_go32_nat): Adjust to C++ification.
* gnu-nat.c (gnu_wait, gnu_resume, gnu_kill_inferior)
(gnu_mourn_inferior, gnu_create_inferior, gnu_attach, gnu_detach)
(gnu_stop, gnu_thread_alive, gnu_xfer_partial)
(gnu_find_memory_regions, gnu_pid_to_str): Refactor as methods of
gnu_nat_target.
(gnu_target): Delete.
* gnu-nat.h (gnu_target): Delete.
(gnu_nat_target): New class.
* i386-gnu-nat.c (gnu_base_target): New.
(i386_gnu_nat_target): New class.
(the_i386_gnu_nat_target): New.
(_initialize_i386gnu_nat): Adjust to C++ification.
gdb/testsuite/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
to_log_command renames.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
2018-05-03 01:37:22 +02:00
|
|
|
void
|
|
|
|
record_full_base_target::save_record (const char *recfilename)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
struct record_full_entry *cur_record_full_list;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
uint32_t magic;
|
|
|
|
struct regcache *regcache;
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
int save_size = 0;
|
|
|
|
asection *osec = NULL;
|
|
|
|
int bfd_offset = 0;
|
|
|
|
|
|
|
|
/* Open the save file. */
|
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "Saving execution log to core file '%s'\n",
|
|
|
|
recfilename);
|
|
|
|
|
|
|
|
/* Open the output file. */
|
2016-11-22 00:26:20 +01:00
|
|
|
gdb_bfd_ref_ptr obfd (create_gcore_bfd (recfilename));
|
|
|
|
|
|
|
|
/* Arrange to remove the output file on failure. */
|
|
|
|
gdb::unlinker unlink_file (recfilename);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Save the current record entry to "cur_record_full_list". */
|
|
|
|
cur_record_full_list = record_full_list;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Get the values of regcache and gdbarch. */
|
|
|
|
regcache = get_current_regcache ();
|
2017-10-25 17:37:03 +02:00
|
|
|
gdbarch = regcache->arch ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Disable the GDB operation record. */
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore restore_operation_disable
|
|
|
|
= record_full_gdb_operation_disable_set ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Reverse execute to the begin of record list. */
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
/* Check for beginning and end of log. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list == &record_full_first)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_exec_insn (regcache, gdbarch, record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list->prev)
|
|
|
|
record_full_list = record_full_list->prev;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the size needed for the extra bfd section. */
|
|
|
|
save_size = 4; /* magic cookie */
|
2013-03-11 09:44:14 +01:00
|
|
|
for (record_full_list = record_full_first.next; record_full_list;
|
|
|
|
record_full_list = record_full_list->next)
|
|
|
|
switch (record_full_list->type)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_end:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
save_size += 1 + 4 + 4;
|
|
|
|
break;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_reg:
|
|
|
|
save_size += 1 + 4 + record_full_list->u.reg.len;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_mem:
|
|
|
|
save_size += 1 + 4 + 8 + record_full_list->u.mem.len;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make the new bfd section. */
|
2016-11-22 00:26:20 +01:00
|
|
|
osec = bfd_make_section_anyway_with_flags (obfd.get (), "precord",
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
SEC_HAS_CONTENTS
|
|
|
|
| SEC_READONLY);
|
|
|
|
if (osec == NULL)
|
|
|
|
error (_("Failed to create 'precord' section for corefile %s: %s"),
|
|
|
|
recfilename,
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
|
|
|
bfd_set_section_size (osec, save_size);
|
|
|
|
bfd_set_section_vma (osec, 0);
|
|
|
|
bfd_set_section_alignment (osec, 0);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Save corefile state. */
|
2016-11-22 00:26:20 +01:00
|
|
|
write_gcore_file (obfd.get ());
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Write out the record log. */
|
|
|
|
/* Write the magic code. */
|
2013-03-11 09:44:14 +01:00
|
|
|
magic = RECORD_FULL_FILE_MAGIC;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Writing 4-byte magic cookie "
|
2013-03-11 09:44:14 +01:00
|
|
|
"RECORD_FULL_FILE_MAGIC (0x%s)\n",
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
phex_nz (magic, 4));
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &magic, sizeof (magic), &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Save the entries to recfd and forward execute to the end of
|
|
|
|
record list. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list = &record_full_first;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
/* Save entry. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list != &record_full_first)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
uint8_t type;
|
|
|
|
uint32_t regnum, len, signal, count;
|
|
|
|
uint64_t addr;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
type = record_full_list->type;
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &type, sizeof (type), &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
switch (record_full_list->type)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_reg: /* reg */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Writing register %d (1 "
|
|
|
|
"plus %lu plus %d bytes)\n",
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->u.reg.num,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
(unsigned long) sizeof (regnum),
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->u.reg.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Write regnum. */
|
2013-03-11 09:44:14 +01:00
|
|
|
regnum = netorder32 (record_full_list->u.reg.num);
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, ®num,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
sizeof (regnum), &bfd_offset);
|
|
|
|
|
|
|
|
/* Write regval. */
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec,
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_loc (record_full_list),
|
|
|
|
record_full_list->u.reg.len, &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_mem: /* mem */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
|
|
" Writing memory %s (1 plus "
|
|
|
|
"%lu plus %lu plus %d bytes)\n",
|
|
|
|
paddress (gdbarch,
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->u.mem.addr),
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
(unsigned long) sizeof (addr),
|
|
|
|
(unsigned long) sizeof (len),
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list->u.mem.len);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Write memlen. */
|
2013-03-11 09:44:14 +01:00
|
|
|
len = netorder32 (record_full_list->u.mem.len);
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &len, sizeof (len),
|
|
|
|
&bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Write memaddr. */
|
2013-03-11 09:44:14 +01:00
|
|
|
addr = netorder64 (record_full_list->u.mem.addr);
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &addr,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
sizeof (addr), &bfd_offset);
|
|
|
|
|
|
|
|
/* Write memval. */
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec,
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_get_loc (record_full_list),
|
|
|
|
record_full_list->u.mem.len, &bfd_offset);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
case record_full_end:
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (record_debug)
|
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2013-03-11 09:44:14 +01:00
|
|
|
" Writing record_full_end (1 + "
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
"%lu + %lu bytes)\n",
|
|
|
|
(unsigned long) sizeof (signal),
|
|
|
|
(unsigned long) sizeof (count));
|
|
|
|
/* Write signal value. */
|
2013-03-11 09:44:14 +01:00
|
|
|
signal = netorder32 (record_full_list->u.end.sigval);
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &signal,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
sizeof (signal), &bfd_offset);
|
|
|
|
|
|
|
|
/* Write insn count. */
|
2013-03-11 09:44:14 +01:00
|
|
|
count = netorder32 (record_full_list->u.end.insn_num);
|
2016-11-22 00:26:20 +01:00
|
|
|
bfdcore_write (obfd.get (), osec, &count,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
sizeof (count), &bfd_offset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Execute entry. */
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_exec_insn (regcache, gdbarch, record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list->next)
|
|
|
|
record_full_list = record_full_list->next;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Reverse execute to cur_record_full_list. */
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
/* Check for beginning and end of log. */
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list == cur_record_full_list)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
break;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_exec_insn (regcache, gdbarch, record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
if (record_full_list->prev)
|
|
|
|
record_full_list = record_full_list->prev;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
2016-11-22 00:26:20 +01:00
|
|
|
unlink_file.keep ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Succeeded. */
|
|
|
|
printf_filtered (_("Saved core file %s with execution log.\n"),
|
|
|
|
recfilename);
|
|
|
|
}
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* record_full_goto_insn -- rewind the record log (forward or backward,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
depending on DIR) to the given entry, changing the program state
|
|
|
|
correspondingly. */
|
|
|
|
|
|
|
|
static void
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_goto_insn (struct record_full_entry *entry,
|
|
|
|
enum exec_direction_kind dir)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-09-30 05:49:04 +02:00
|
|
|
scoped_restore restore_operation_disable
|
|
|
|
= record_full_gdb_operation_disable_set ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
struct regcache *regcache = get_current_regcache ();
|
2017-10-25 17:37:03 +02:00
|
|
|
struct gdbarch *gdbarch = regcache->arch ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Assume everything is valid: we will hit the entry,
|
|
|
|
and we will not hit the end of the recording. */
|
|
|
|
|
|
|
|
if (dir == EXEC_FORWARD)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list = record_full_list->next;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_exec_insn (regcache, gdbarch, record_full_list);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
if (dir == EXEC_REVERSE)
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list = record_full_list->prev;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
else
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list = record_full_list->next;
|
|
|
|
} while (record_full_list != entry);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alias for "target record-full". */
|
|
|
|
|
|
|
|
static void
|
Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.
In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors". These overloads are temporary; once constification is
complete they can be removed.
This patch also fixes a typo I happened to notice while constifying.
Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build. So, while I made a best-effort there, I am not
certain they will still compile.
Tested by rebuilding.
gdb/ChangeLog
2017-10-11 Tom Tromey <tom@tromey.com>
* gdbthread.h (thread_command): Constify.
* inferior.h (detach_command): Constify.
* top.h (set_history, show_history): Constify.
* arm-tdep.c (set_arm_command, show_arm_command): Constify.
* serial.c (serial_set_cmd, serial_show_cmd): Constify.
* bsd-kvm.c (bsd_kvm_cmd): Constify.
* printcmd.c (set_command): Constify.
(non_const_set_command): New function.
* dcache.c (set_dcache_command, show_dcache_command): Constify.
* breakpoint.c (enable_command, disable_command, delete_command)
(catch_command, tcatch_command, set_breakpoint_cmd)
(show_breakpoint_cmd): Constify.
* macrocmd.c (macro_command): Constify.
* infcmd.c (unset_command, kill_command, detach_command)
(info_proc_cmd): Constify.
* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
(info_auto_load_cmd): Constify.
* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
(unset_tdesc_cmd): Constify.
* ada-lang.c (set_ada_command, show_ada_command)
(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
* guile/guile.c (set_guile_command, show_guile_command)
(info_guile_command): Constify.
* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
Constify.
* skip.c (skip_command): Constify.
* compile/compile.c (_initialize_compile): Constify.
* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
(maint_btrace_pt_show_cmd): Constify.
* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
Constify.
* python/python.c (user_show_python, user_set_python): Constify.
* mips-tdep.c (set_mips_command, show_mips_command)
(set_mipsfpu_command): Constify.
* record-btrace.c (cmd_record_btrace_start)
(cmd_set_record_btrace, cmd_show_record_btrace)
(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
Constify.
* symfile.c (overlay_command): Constify.
* spu-tdep.c (set_spu_command, show_spu_command): Constify.
* cli/cli-logging.c (set_logging_command, show_logging_command):
Constify.
* cli/cli-dump.c (dump_command, append_command)
(srec_dump_command, ihex_dump_command, verilog_dump_command)
(tekhex_dump_command, binary_dump_command)
(binary_append_command): Constify.
* cli/cli-decode.c (struct cmd_list_element): Change type of
"fun".
* cli/cli-cmds.c (info_command, show_command, set_debug)
(show_debug): Constify.
(show_command): Add non-const overload.
* top.c (set_history, show_history): Constify.
* sh-tdep.c (set_sh_command, show_sh_command): Constify.
* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
* target.c (target_command): Constify.
* sparc64-tdep.c (info_adi_command): Constify.
* record-full.c (cmd_record_full_start): Constify.
(set_record_full_command): Constify. Fix typo.
(show_record_full_command): Constify.
* thread.c (thread_command, thread_apply_command): Constify.
* memattr.c (dummy_cmd): Constify.
* value.c (function_command): Constify.
* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
* probe.c (info_probes_command): Constify.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
(show_thread_cmd, set_thread_default_cmd)
(show_thread_default_cmd): Constify.
(check_empty): Constify.
* tracepoint.c (tfind_command): Constify.
* cp-support.c (maint_cplus_command): Constify.
* windows-tdep.c (info_w32_command): Constify.
* record.c (cmd_record_start, set_record_command)
(show_record_command, info_record_command, cmd_record_goto):
Constify.
* ravenscar-thread.c (set_ravenscar_command)
(show_ravenscar_command): Constify.
* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
Constify.
(add_internal_problem_command): Remove casts.
* arc-tdep.c (maintenance_print_arc_command): Constify.
* valprint.c (set_print, show_print, set_print_raw)
(show_print_raw): Constify.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_print_command, maintenance_set_cmd)
(maintenance_show_cmd, set_per_command_cmd)
(show_per_command_cmd, maintenance_check_command): Constify.
* language.c (set_check, show_check): Constify.
* typeprint.c (show_print_type, set_print_type): Constify.
* go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
|
|
|
cmd_record_full_start (const char *args, int from_tty)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2017-10-15 16:36:51 +02:00
|
|
|
execute_command ("target record-full", from_tty);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Constify add_setshow_*
This constifies the add_setshow_* family of functions, and then fixes
up the fallout. The bulk of this patch was written by script.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* ada-lang.c (catch_ada_exception_command): Constify.
(catch_assert_command): Constify.
* break-catch-throw.c (catch_catch_command, catch_throw_command)
(catch_rethrow_command): Constify.
(catch_exception_command_1): Constify.
* breakpoint.h (add_catch_command): Constify.
* break-catch-syscall.c (catch_syscall_command_1): Constify.
(catch_syscall_split_args): Constify.
* break-catch-sig.c (catch_signal_command): Constify.
(catch_signal_split_args): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Use
cmd_const_sfunc_ftype.
* cli/cli-decode.c (add_setshow_cmd_full): Constify.
(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, struct cmd_list_element)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
Constify.
(set_cmd_sfunc): Constify.
(empty_sfunc): Constify.
* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Constify.
(set_cmd_sfunc): Constify.
(cmd_sfunc_ftype): Remove.
* compile/compile.c (set_compile_args): Constify.
* infrun.c (set_disable_randomization): Constify.
* infcmd.c (set_args_command, set_cwd_command): Constify.
* breakpoint.c (set_condition_evaluation_mode): Constify.
(add_catch_command): Constify.
(catch_fork_command_1, catch_exec_command_1)
(catch_load_command_1, catch_unload_command_1): Constify.
(catch_load_or_unload): Constify.
* guile/scm-param.c (pascm_set_func): Constify.
(add_setshow_generic): Constify.
* python/py-param.c (get_set_value): Constify.
* top.h (set_verbose): Constify.
* tui/tui-win.c (tui_set_var_cmd): Constify.
* mi/mi-main.c (set_mi_async_command): Constify.
* cli/cli-logging.c (set_logging_overwrite)
(set_logging_redirect): Constify.
* value.c (set_max_value_size): Constify.
* valprint.c (set_input_radix, set_output_radix): Constify.
* utils.c (set_width_command, set_height_command): Constify.
* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
* tracepoint.c (set_disconnected_tracing)
(set_circular_trace_buffer, set_trace_buffer_size)
(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
* top.c (set_history_size_command, set_verbose, set_editing)
(set_gdb_datadir, set_history_filename): Constify.
* target.c (set_targetdebug, maint_set_target_async_command)
(maint_set_target_non_stop_command, set_target_permissions)
(set_write_memory_permission): Constify.
(open_target): Constify.
* target-descriptions.c (set_tdesc_filename_cmd): Constify.
* target-dcache.c (set_stack_cache, set_code_cache): Constify.
* symtab.c (set_symbol_cache_size_handler): Constify.
* symfile.c (set_ext_lang_command): Constify.
* symfile-debug.c (set_debug_symfile): Constify.
* source.c (set_directories_command): Constify.
* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
* serial.c (set_parity): Constify.
* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
* remote.c (set_remote_exec_file, set_remotebreak)
(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
* record.c (set_record_insn_history_size)
(set_record_call_history_size): Constify.
* record-full.c (set_record_full_insn_max_num): Constify.
* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
* osabi.c (set_osabi): Constify.
* mips-tdep.c (set_mips64_transfers_32bit_regs)
(reinit_frame_cache_sfunc, mips_abi_update): Constify.
* maint.c (maintenance_set_profile_cmd): Constify.
* linux-thread-db.c (set_libthread_db_search_path): Constify.
* language.c (set_language_command, set_range_command)
(set_case_command): Constify.
* infrun.c (set_non_stop, set_observer_mode)
(set_stop_on_solib_events, set_schedlock_func)
(set_exec_direction_func): Constify.
* infcmd.c (set_inferior_tty_command): Constify.
* disasm.c (set_disassembler_options_sfunc): Constify.
* demangle.c (set_demangling_command): Constify.
* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
* cris-tdep.c (set_cris_version, set_cris_mode)
(set_cris_dwarf2_cfi): Constify.
* corefile.c (set_gnutarget_command): Constify.
* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
(set_target_wide_charset_sfunc): Constify.
* breakpoint.c (update_dprintf_commands): Constify.
* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
(set_disassembly_style_sfunc): Constify.
* arch-utils.c (set_endian, set_architecture): Constify.
* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
* agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
|
|
|
set_record_full_insn_max_num (const char *args, int from_tty,
|
2013-03-11 09:44:14 +01:00
|
|
|
struct cmd_list_element *c)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned. Looking over the code, there's
no case the variable could end up negative.
Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally. IOW,
the command's variable is never 0. The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.
Tested on x86_64 Fedora 17.
gdb/
2013-03-26 Pedro Alves <palves@redhat.com>
* record-full.c (record_full_insn_num): Make it unsigned.
(record_full_check_insn_num, record_full_message)
(record_full_registers_change, record_full_xfer_partial): Remove
record_full_insn_max_num check (it's always != 0).
(record_full_info, record_full_restore): Use %u as format string.
(): Use %u as format string.
(set_record_full_insn_max_num): Remove record_full_insn_max_num
check (it's always != 0).
2013-03-26 21:01:03 +01:00
|
|
|
if (record_full_insn_num > record_full_insn_max_num)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Count down record_full_insn_num while releasing records from list. */
|
|
|
|
while (record_full_insn_num > record_full_insn_max_num)
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
2013-03-11 09:44:14 +01:00
|
|
|
record_full_list_release_first ();
|
|
|
|
record_full_insn_num--;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-13 20:01:38 +01:00
|
|
|
void _initialize_record_full ();
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
void
|
2020-01-13 20:01:38 +01:00
|
|
|
_initialize_record_full ()
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
{
|
|
|
|
struct cmd_list_element *c;
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
/* Init record_full_first. */
|
|
|
|
record_full_first.prev = NULL;
|
|
|
|
record_full_first.next = NULL;
|
|
|
|
record_full_first.type = record_full_end;
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
target factories, target open and multiple instances of targets
Currently, to open a target, with "target TARGET_NAME", GDB finds the
target_ops instance with "TARGET_NAME" as short name, and then calls
its target_ops::open virtual method. In reality, there's no actual
target/name lookup, a pointer to the target_ops object was associated
with the "target TARGET_NAME" command at add_target time (when GDB is
initialized), as the command's context.
This creates a chicken and egg situation. Consider the case of
wanting to open multiple remote connections. We want to be able to
have one remote target_ops instance per connection, but, if we're not
connected yet, so we don't yet have an instance to call target->open()
on...
This patch fixes this by separating out common info about a target_ops
to a separate structure (shortname, longname, doc), and changing the
add_target routine to take a reference to such an object instead of a
pointer to a target_ops, and a pointer to a factory function that is
responsible to open an instance of the corresponding target when the
user types "target TARGET_NAME".
-extern void add_target (struct target_ops *);
+extern void add_target (const target_info &info, target_open_ftype *func);
I.e. this factory function replaces the target_ops::open virtual
method.
For static/singleton targets, nothing changes, the target_open_ftype
function pushes the global target_ops instance on the target stack.
At target_close time, the connection is tor down, but the global
target_ops object remains live.
However, targets that support being open multiple times will make
their target_open_ftype routine allocate a new target_ops instance on
the heap [e.g., new remote_target()], and push that on the stack. At
target_close time, the new object is destroyed (by the
target_ops::close virtual method).
Both the core target and the remote targets will support being open
multiple times (others could/should too, but those were my stopping
point), but not in this patch yet. We need to get rid of more globals
first before that'd be useful.
Native targets are somewhat special, given find_default_run_target &
friends. Those routines also expect to return a target_ops pointer,
even before we've open the target. However, we'll never need more
than one instance of the native target, so we can assume/require that
native targets are global/simpletons, and have the backends register a
pointer to the native target_ops. Since all native targets inherit
inf_child_target, we can centralize that registration. See
add_inf_child_target, get_native_target/set_native_target and
find_default_run_target.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Use
add_inf_child_target.
* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Use
add_inf_child_target.
* aix-thread.c (aix_thread_target_info): New.
(aix_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* alpha-bsd-nat.c (_initialize_alphabsd_nat): Use
add_inf_child_target.
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Use
add_inf_child_target.
* amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Use
add_inf_child_target.
* amd64-linux-nat.c (_initialize_amd64_linux_nat): Use
add_inf_child_target.
* amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Use
add_inf_child_target.
* amd64-obsd-nat.c (_initialize_amd64obsd_nat): Use
add_inf_child_target.
* arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Use
add_inf_child_target.
* arm-linux-nat.c (_initialize_arm_linux_nat): Use
add_inf_child_target.
* arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Use
add_inf_child_target.
* bfd-target.c (target_bfd_target_info): New.
(target_bfd) <shortname, longname, doc>: Delete.
<info>: New.
* bsd-kvm.c (bsd_kvm_target_info): New.
(bsd_kvm_target) <shortname, longname, doc>: Delete.
<info>: New.
(bsd_kvm_target::open): Rename to ...
(bsd_kvm_target_open): ... this. Adjust.
* bsd-uthread.c (bsd_uthread_target_info): New.
(bsd_uthread_target) <shortname, longname, doc>: Delete.
<info>: New.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_target_info): New.
(core_target) <shortname, longname, doc>: Delete.
<info>: New.
(core_target::open): Rename to ...
(core_target_open): ... this. Adjust.
* ctf.c (ctf_target_info): New.
(ctf_target) <shortname, longname, doc>: Delete.
<info>: New.
(ctf_target::open): Rename to ...
(ctf_target_open): ... this.
(_initialize_ctf): Adjust.
* exec.c (exec_target_info): New.
(exec_target) <shortname, longname, doc>: Delete.
<info>: New.
(exec_target::open): Rename to ...
(exec_target_open): ... this.
* gdbcore.h (core_target_open): Declare.
* go32-nat.c (_initialize_go32_nat): Use add_inf_child_target.
* hppa-linux-nat.c (_initialize_hppa_linux_nat): Use
add_inf_child_target.
* hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Use
add_inf_child_target.
* hppa-obsd-nat.c (_initialize_hppaobsd_nat): Use
add_inf_child_target.
* i386-darwin-nat.c (_initialize_i386_darwin_nat): Use
add_inf_child_target.
* i386-fbsd-nat.c (_initialize_i386fbsd_nat): Use
add_inf_child_target.
* i386-gnu-nat.c (_initialize_i386gnu_nat): Use
add_inf_child_target.
* i386-linux-nat.c (_initialize_i386_linux_nat): Use
add_inf_child_target.
* i386-nbsd-nat.c (_initialize_i386nbsd_nat): Use
add_inf_child_target.
* i386-obsd-nat.c (_initialize_i386obsd_nat): Use
add_inf_child_target.
* ia64-linux-nat.c (_initialize_ia64_linux_nat): Use
add_inf_child_target.
* inf-child.c (inf_child_target_info): New.
(inf_child_target::info): New.
(inf_child_open_target): Remove 'target' parameter. Use
get_native_target instead.
(inf_child_target::open): Delete.
(add_inf_child_target): New.
* inf-child.h (inf_child_target) <shortname, longname, doc, open>:
Delete.
<info>: New.
(add_inf_child_target): Declare.
(inf_child_open_target): Declare.
* linux-thread-db.c (thread_db_target_info): New.
(thread_db_target) <shortname, longname, doc>: Delete.
<info>: New.
* m32r-linux-nat.c (_initialize_m32r_linux_nat): Use
add_inf_child_target.
* m68k-bsd-nat.c (_initialize_m68kbsd_nat): Use
add_inf_child_target.
* m68k-linux-nat.c (_initialize_m68k_linux_nat): Use
add_inf_child_target.
* m88k-bsd-nat.c (_initialize_m88kbsd_nat): Use
add_inf_child_target.
* make-target-delegates (print_class): Adjust.
* mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Use
add_inf_child_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): Use
add_inf_child_target.
* mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Use
add_inf_child_target.
* mips64-obsd-nat.c (_initialize_mips64obsd_nat): Use
add_inf_child_target.
* nto-procfs.c (nto_native_target_info): New.
(nto_procfs_target_native) <shortname, longname, doc>:
Delete.
<info>: New.
(nto_procfs_target_info): New.
(nto_procfs_target_procfs) <shortname, longname, doc>:
Delete.
<info>: New.
(init_procfs_targets): Adjust.
* ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Use
add_inf_child_target.
* ppc-linux-nat.c (_initialize_ppc_linux_nat): Use
add_inf_child_target.
* ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Use
add_inf_child_target.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Use
add_inf_child_target.
* ravenscar-thread.c (ravenscar_target_info): New.
(ravenscar_thread_target) <shortname, longname, doc>:
Delete.
<info>: New.
* record-btrace.c (record_btrace_target_info):
(record_btrace_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_btrace_target::open): Rename to ...
(record_btrace_target_open): ... this. Adjust.
* record-full.c (record_longname, record_doc): New.
(record_full_base_target) <shortname, longname, doc>: Delete.
<info>: New.
(record_full_target_info): New.
(record_full_target): <shortname>: Delete.
<info>: New.
(record_full_core_open_1, record_full_open_1): Update comments.
(record_full_base_target::open): Rename to ...
(record_full_open): ... this.
(cmd_record_full_restore): Update.
(_initialize_record_full): Update.
* remote-sim.c (remote_sim_target_info): New.
(gdbsim_target) <shortname, longname, doc>: Delete.
<info>: New.
(gdbsim_target::open): Rename to ...
(gdbsim_target_open): ... this.
(_initialize_remote_sim): Adjust.
* remote.c (remote_doc): New.
(remote_target_info): New.
(remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(extended_remote_target_info): New.
(extended_remote_target) <shortname, longname, doc>: Delete.
<info>: New.
(remote_target::open_1): Make static. Adjust.
* rs6000-nat.c (_initialize_rs6000_nat): Use add_inf_child_target.
* s390-linux-nat.c (_initialize_s390_nat): Use
add_inf_child_target.
* sh-nbsd-nat.c (_initialize_shnbsd_nat): Use
add_inf_child_target.
* sol-thread.c (thread_db_target_info): New.
(sol_thread_target) <shortname, longname, doc>: Delete.
<info>: New.
* sparc-linux-nat.c (_initialize_sparc_linux_nat): Use
add_inf_child_target.
* sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Use
add_inf_child_target.
* sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Use
add_inf_child_target.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
add_inf_child_target.
* sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Use
add_inf_child_target.
* sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Use
add_inf_child_target.
* spu-linux-nat.c (_initialize_spu_nat): Use
add_inf_child_target.
* spu-multiarch.c (spu_multiarch_target_info): New.
(spu_multiarch_target) <shortname, longname, doc>: Delete.
<info>: New.
* target-delegates.c: Regenerate.
* target.c: Include <unordered_map>.
(target_ops_p): Delete.
(DEF_VEC_P(target_ops_p)): Delete.
(target_factories): New.
(test_target_info): New.
(test_target_ops::info): New.
(open_target): Adjust to use target_factories.
(add_target_with_completer): Rename to ...
(add_target): ... this. Change prototype. Register target_info
and open callback in target_factories. Register target_info in
command context instead of target_ops.
(add_target): Delete old implementation.
(add_deprecated_target_alias): Change prototype. Adjust.
(the_native_target): New.
(set_native_target, get_native_target): New.
(find_default_run_target): Use the_native_target.
(find_attach_target, find_run_target): Simplify.
(target_ops::open): Delete.
(dummy_target_info): New.
(dummy_target::shortname, dummy_target::longname)
(dummy_target::doc): Delete.
(dummy_target::info): New.
(debug_target::shortname, debug_target::longname)
(debug_target::doc): Delete.
(debug_target::info): New.
* target.h (struct target_info): New.
(target_ops::~target_ops): Add comment.
(target_ops::info): New.
(target_ops::shortname, target_ops::longname, target_ops::doc): No
longer virtual. Implement in terms of target_info.
(set_native_target, get_native_target): Declare.
(target_open_ftype): New.
(add_target, add_target_with_completer)
(add_deprecated_target_alias): Change prototype.
(test_target) <shortname, longname, doc>: Delete.
<info>: New.
* tilegx-linux-nat.c (_initialize_tile_linux_nat): Use
add_inf_child_target.
* tracefile-tfile.c (tfile_target_info): New.
(tfile_target) <shortname, longname, doc>: Delete.
<info>: New.
(tfile_target::open): Rename to ...
(tfile_target_open): ... this.
(_initialize_tracefile_tfile): Adjust.
* vax-bsd-nat.c (_initialize_vaxbsd_nat): Use
add_inf_child_target.
* windows-nat.c (_initialize_windows_nat): Use
add_inf_child_target.
* xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Use
add_inf_child_target.
2018-05-03 01:37:32 +02:00
|
|
|
add_target (record_full_target_info, record_full_open);
|
|
|
|
add_deprecated_target_alias (record_full_target_info, "record");
|
|
|
|
add_target (record_full_core_target_info, record_full_open);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
add_prefix_cmd ("full", class_obscure, cmd_record_full_start,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
_("Start full execution recording."), &record_full_cmdlist,
|
|
|
|
"record full ", 0, &record_cmdlist);
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
c = add_cmd ("restore", class_obscure, cmd_record_full_restore,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
_("Restore the execution log from a file.\n\
|
|
|
|
Argument is filename. File must be created with 'record save'."),
|
|
|
|
&record_full_cmdlist);
|
|
|
|
set_cmd_completer (c, filename_completer);
|
|
|
|
|
|
|
|
/* Deprecate the old version without "full" prefix. */
|
|
|
|
c = add_alias_cmd ("restore", "full restore", class_obscure, 1,
|
|
|
|
&record_cmdlist);
|
|
|
|
set_cmd_completer (c, filename_completer);
|
|
|
|
deprecate_cmd (c, "record full restore");
|
|
|
|
|
Replace most calls to help_list and cmd_show_list
Currently there are many prefix commands that do nothing but call
either help_list or cmd_show_list. I happened to notice that one such
call, for "set print type", used the wrong command list parameter,
causing incorrect output.
Rather than fix this bug in isolation, I decided to eliminate this
possibility by adding two new ways to add prefix commands, which
simply route the call to help_list or cmd_show_list, as appropriate.
This makes it impossible for a mismatch to occur.
In some cases, a bit of output was removed; however, I don't think
this output in general was very useful. It seemed redundant with
what's already printed by help_list. A representative example is this
hunk, removed from ada-lang.c:
- printf_unfiltered (_(\
-"\"set ada\" must be followed by the name of a setting.\n"));
This simplified the CLI style set/show commands quite a bit, and
allowed the deletion of a macro.
This also cleans up some unusual code in windows-tdep.c.
Tested on x86-64 Fedora 30. Note that I have no way to build the
go32-nat.c change.
gdb/ChangeLog
2020-04-17 Tom Tromey <tromey@adacore.com>
* auto-load.c (show_auto_load_cmd): Remove.
(auto_load_show_cmdlist_get): Use add_show_prefix_cmd.
* arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd.
(maintenance_print_arc_command): Remove.
* tui/tui-win.c (tui_command): Remove.
(tui_get_cmd_list): Use add_basic_prefix_cmd.
* tui/tui-layout.c (tui_layout_command): Remove.
(_initialize_tui_layout): Use add_basic_prefix_cmd.
* python/python.c (user_set_python, user_show_python): Remove.
(_initialize_python): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* guile/guile.c (set_guile_command, show_guile_command): Remove.
(install_gdb_commands): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_guile_command): Remove.
* dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove.
(_initialize_dwarf2_read): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
Remove do_set and do_show parameters.
* cli/cli-style.c (set_style, show_style): Remove.
(_initialize_cli_style): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(cli_style_option::add_setshow_commands): Remove do_set and
do_show parameters.
(cli_style_option::add_setshow_commands): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
(STYLE_ADD_SETSHOW_COMMANDS): Remove macro.
(set_style_name): Remove.
* cli/cli-dump.c (dump_command, append_command): Remove.
(srec_dump_command, ihex_dump_command, verilog_dump_command)
(tekhex_dump_command, binary_dump_command)
(binary_append_command): Remove.
(_initialize_cli_dump): Use add_basic_prefix_cmd.
* windows-tdep.c (w32_prefix_command_valid): Remove global.
(init_w32_command_list): Remove; move into ...
(_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd.
* valprint.c (set_print, show_print, set_print_raw)
(show_print_raw): Remove.
(_initialize_valprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* typeprint.c (set_print_type, show_print_type): Remove.
(_initialize_typeprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record.c (set_record_command, show_record_command): Remove.
(_initialize_record): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_command, show_command, set_debug, show_debug): Remove.
* top.h (set_history, show_history): Don't declare.
* top.c (set_history, show_history): Remove.
* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
(unset_tdesc_cmd): Remove.
(_initialize_target_descriptions): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* symtab.c (info_module_command): Remove.
(_initialize_symtab): Use add_basic_prefix_cmd.
* symfile.c (overlay_command): Remove.
(_initialize_symfile): Use add_basic_prefix_cmd.
* sparc64-tdep.c (info_adi_command): Remove.
(_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd.
* sh-tdep.c (show_sh_command, set_sh_command): Remove.
(_initialize_sh_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* serial.c (serial_set_cmd, serial_show_cmd): Remove.
(_initialize_serial): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove.
(_initialize_ser_tcp): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* rs6000-tdep.c (set_powerpc_command, show_powerpc_command)
(_initialize_rs6000_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* riscv-tdep.c (show_riscv_command, set_riscv_command)
(show_debug_riscv_command, set_debug_riscv_command): Remove.
(_initialize_riscv_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* remote.c (remote_command, set_remote_cmd): Remove.
(_initialize_remote): Use add_basic_prefix_cmd.
* record-full.c (set_record_full_command)
(show_record_full_command): Remove.
(_initialize_record_full): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record-btrace.c (cmd_set_record_btrace)
(cmd_show_record_btrace, cmd_set_record_btrace_bts)
(cmd_show_record_btrace_bts, cmd_set_record_btrace_pt)
(cmd_show_record_btrace_pt): Remove.
(_initialize_record_btrace): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ravenscar-thread.c (set_ravenscar_command)
(show_ravenscar_command): Remove.
(_initialize_ravenscar): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* mips-tdep.c (show_mips_command, set_mips_command)
(_initialize_mips_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_check_command, maintenance_print_command)
(maintenance_set_cmd, maintenance_show_cmd): Remove.
(_initialize_maint_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(show_per_command_cmd): Remove.
* maint-test-settings.c (maintenance_set_test_settings_cmd):
Remove.
(maintenance_show_test_settings_cmd): Remove.
(_initialize_maint_test_settings): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint-test-options.c (maintenance_test_options_command):
Remove.
(_initialize_maint_test_options): Use add_basic_prefix_cmd.
* macrocmd.c (macro_command): Remove
(_initialize_macrocmd): Use add_basic_prefix_cmd.
* language.c (set_check, show_check): Remove.
(_initialize_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* infcmd.c (unset_command): Remove.
(_initialize_infcmd): Use add_basic_prefix_cmd.
* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove.
(_initialize_i386_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* go32-nat.c (go32_info_dos_command): Remove.
(_initialize_go32_nat): Use add_basic_prefix_cmd.
* cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd)
(do_show_prefix_cmd, add_show_prefix_cmd): New functions.
* frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove.
(_initialize_frame): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* dcache.c (set_dcache_command, show_dcache_command): Remove.
(_initialize_dcache): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cp-support.c (maint_cplus_command): Remove.
(_initialize_cp_support): Use add_basic_prefix_cmd.
* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
(maint_btrace_pt_show_cmd, _initialize_btrace): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
* breakpoint.c (save_command): Remove.
(_initialize_breakpoint): Use add_basic_prefix_cmd.
* arm-tdep.c (set_arm_command, show_arm_command): Remove.
(_initialize_arm_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd)
(set_ada_command, show_ada_command): Remove.
(_initialize_ada_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare.
gdb/testsuite/ChangeLog
2020-04-17 Tom Tromey <tromey@adacore.com>
* gdb.cp/maint.exp (test_help): Simplify multiple_help_body.
Update tests.
* gdb.btrace/cpu.exp: Update tests.
* gdb.base/maint.exp: Update tests.
* gdb.base/default.exp: Update tests.
* gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
|
|
|
add_basic_prefix_cmd ("full", class_support,
|
|
|
|
_("Set record options."), &set_record_full_cmdlist,
|
|
|
|
"set record full ", 0, &set_record_cmdlist);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
Replace most calls to help_list and cmd_show_list
Currently there are many prefix commands that do nothing but call
either help_list or cmd_show_list. I happened to notice that one such
call, for "set print type", used the wrong command list parameter,
causing incorrect output.
Rather than fix this bug in isolation, I decided to eliminate this
possibility by adding two new ways to add prefix commands, which
simply route the call to help_list or cmd_show_list, as appropriate.
This makes it impossible for a mismatch to occur.
In some cases, a bit of output was removed; however, I don't think
this output in general was very useful. It seemed redundant with
what's already printed by help_list. A representative example is this
hunk, removed from ada-lang.c:
- printf_unfiltered (_(\
-"\"set ada\" must be followed by the name of a setting.\n"));
This simplified the CLI style set/show commands quite a bit, and
allowed the deletion of a macro.
This also cleans up some unusual code in windows-tdep.c.
Tested on x86-64 Fedora 30. Note that I have no way to build the
go32-nat.c change.
gdb/ChangeLog
2020-04-17 Tom Tromey <tromey@adacore.com>
* auto-load.c (show_auto_load_cmd): Remove.
(auto_load_show_cmdlist_get): Use add_show_prefix_cmd.
* arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd.
(maintenance_print_arc_command): Remove.
* tui/tui-win.c (tui_command): Remove.
(tui_get_cmd_list): Use add_basic_prefix_cmd.
* tui/tui-layout.c (tui_layout_command): Remove.
(_initialize_tui_layout): Use add_basic_prefix_cmd.
* python/python.c (user_set_python, user_show_python): Remove.
(_initialize_python): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* guile/guile.c (set_guile_command, show_guile_command): Remove.
(install_gdb_commands): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_guile_command): Remove.
* dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove.
(_initialize_dwarf2_read): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
Remove do_set and do_show parameters.
* cli/cli-style.c (set_style, show_style): Remove.
(_initialize_cli_style): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(cli_style_option::add_setshow_commands): Remove do_set and
do_show parameters.
(cli_style_option::add_setshow_commands): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
(STYLE_ADD_SETSHOW_COMMANDS): Remove macro.
(set_style_name): Remove.
* cli/cli-dump.c (dump_command, append_command): Remove.
(srec_dump_command, ihex_dump_command, verilog_dump_command)
(tekhex_dump_command, binary_dump_command)
(binary_append_command): Remove.
(_initialize_cli_dump): Use add_basic_prefix_cmd.
* windows-tdep.c (w32_prefix_command_valid): Remove global.
(init_w32_command_list): Remove; move into ...
(_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd.
* valprint.c (set_print, show_print, set_print_raw)
(show_print_raw): Remove.
(_initialize_valprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* typeprint.c (set_print_type, show_print_type): Remove.
(_initialize_typeprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record.c (set_record_command, show_record_command): Remove.
(_initialize_record): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_command, show_command, set_debug, show_debug): Remove.
* top.h (set_history, show_history): Don't declare.
* top.c (set_history, show_history): Remove.
* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
(unset_tdesc_cmd): Remove.
(_initialize_target_descriptions): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* symtab.c (info_module_command): Remove.
(_initialize_symtab): Use add_basic_prefix_cmd.
* symfile.c (overlay_command): Remove.
(_initialize_symfile): Use add_basic_prefix_cmd.
* sparc64-tdep.c (info_adi_command): Remove.
(_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd.
* sh-tdep.c (show_sh_command, set_sh_command): Remove.
(_initialize_sh_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* serial.c (serial_set_cmd, serial_show_cmd): Remove.
(_initialize_serial): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove.
(_initialize_ser_tcp): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* rs6000-tdep.c (set_powerpc_command, show_powerpc_command)
(_initialize_rs6000_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* riscv-tdep.c (show_riscv_command, set_riscv_command)
(show_debug_riscv_command, set_debug_riscv_command): Remove.
(_initialize_riscv_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* remote.c (remote_command, set_remote_cmd): Remove.
(_initialize_remote): Use add_basic_prefix_cmd.
* record-full.c (set_record_full_command)
(show_record_full_command): Remove.
(_initialize_record_full): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record-btrace.c (cmd_set_record_btrace)
(cmd_show_record_btrace, cmd_set_record_btrace_bts)
(cmd_show_record_btrace_bts, cmd_set_record_btrace_pt)
(cmd_show_record_btrace_pt): Remove.
(_initialize_record_btrace): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ravenscar-thread.c (set_ravenscar_command)
(show_ravenscar_command): Remove.
(_initialize_ravenscar): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* mips-tdep.c (show_mips_command, set_mips_command)
(_initialize_mips_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_check_command, maintenance_print_command)
(maintenance_set_cmd, maintenance_show_cmd): Remove.
(_initialize_maint_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(show_per_command_cmd): Remove.
* maint-test-settings.c (maintenance_set_test_settings_cmd):
Remove.
(maintenance_show_test_settings_cmd): Remove.
(_initialize_maint_test_settings): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint-test-options.c (maintenance_test_options_command):
Remove.
(_initialize_maint_test_options): Use add_basic_prefix_cmd.
* macrocmd.c (macro_command): Remove
(_initialize_macrocmd): Use add_basic_prefix_cmd.
* language.c (set_check, show_check): Remove.
(_initialize_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* infcmd.c (unset_command): Remove.
(_initialize_infcmd): Use add_basic_prefix_cmd.
* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove.
(_initialize_i386_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* go32-nat.c (go32_info_dos_command): Remove.
(_initialize_go32_nat): Use add_basic_prefix_cmd.
* cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd)
(do_show_prefix_cmd, add_show_prefix_cmd): New functions.
* frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove.
(_initialize_frame): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* dcache.c (set_dcache_command, show_dcache_command): Remove.
(_initialize_dcache): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cp-support.c (maint_cplus_command): Remove.
(_initialize_cp_support): Use add_basic_prefix_cmd.
* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
(maint_btrace_pt_show_cmd, _initialize_btrace): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
* breakpoint.c (save_command): Remove.
(_initialize_breakpoint): Use add_basic_prefix_cmd.
* arm-tdep.c (set_arm_command, show_arm_command): Remove.
(_initialize_arm_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd)
(set_ada_command, show_ada_command): Remove.
(_initialize_ada_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare.
gdb/testsuite/ChangeLog
2020-04-17 Tom Tromey <tromey@adacore.com>
* gdb.cp/maint.exp (test_help): Simplify multiple_help_body.
Update tests.
* gdb.btrace/cpu.exp: Update tests.
* gdb.base/maint.exp: Update tests.
* gdb.base/default.exp: Update tests.
* gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
|
|
|
add_show_prefix_cmd ("full", class_support,
|
|
|
|
_("Show record options."), &show_record_full_cmdlist,
|
|
|
|
"show record full ", 0, &show_record_cmdlist);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
/* Record instructions number limit command. */
|
|
|
|
add_setshow_boolean_cmd ("stop-at-limit", no_class,
|
2013-03-11 09:44:14 +01:00
|
|
|
&record_full_stop_at_limit, _("\
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
Set whether record/replay stops when record/replay buffer becomes full."), _("\
|
|
|
|
Show whether record/replay stops when record/replay buffer becomes full."),
|
|
|
|
_("Default is ON.\n\
|
|
|
|
When ON, if the record/replay buffer becomes full, ask user what to do.\n\
|
|
|
|
When OFF, if the record/replay buffer becomes full,\n\
|
|
|
|
delete the oldest recorded instruction to make room for each new one."),
|
|
|
|
NULL, NULL,
|
|
|
|
&set_record_full_cmdlist, &show_record_full_cmdlist);
|
|
|
|
|
|
|
|
c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
|
|
|
|
&set_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "set record full stop-at-limit");
|
|
|
|
|
|
|
|
c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
|
|
|
|
&show_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "show record full stop-at-limit");
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
add_setshow_uinteger_cmd ("insn-number-max", no_class,
|
|
|
|
&record_full_insn_max_num,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
_("Set record/replay buffer limit."),
|
|
|
|
_("Show record/replay buffer limit."), _("\
|
|
|
|
Set the maximum number of instructions to be stored in the\n\
|
Accept "set foo unlimited" in integer/uinteger/zuinteger_unlimited commands.
Currently, several commands take "0" or "-1" to mean "unlimited".
"show" knows when to print "unlimited":
(gdb) show height
Number of lines gdb thinks are in a page is 45.
(gdb) set height 0
(gdb) show height
Number of lines gdb thinks are in a page is unlimited.
However, the user can't herself specify "unlimited" directly:
(gdb) set height unlimited
No symbol table is loaded. Use the "file" command.
(gdb)
This patch addresses that, by adjusting the set handler for all
integer/uinteger/zuinteger_unlimited commands to accept literal
"unlimited". It also installs a completer. Presently, we complete on
symbols by default, and at
<http://sourceware.org/ml/gdb-patches/2013-03/msg00864.html> I've
shown a WIP prototype that tried to keep that half working in these
commands. In the end, it turned out to be more complicated than
justifiable, IMO. It's super rare to want to pass the value of a
variable/symbol in the program to a GDB set/show knob. That'll still
work, it's just that we won't assist with completion anymore. This
patch just sticks with the simple, and completes on "unlimited", and
nothing else. This simplification means that
"set he<tab><tab>"
is all it takes to get to:
"set height unlimited"
The patch then goes through all integer/uinteger/zuinteger_unlimited
commands in the tree, and updates both the online help and the manual
to mention that "unlimited" is accepted in addition to 0/-1. In the
cases where the command had no online help text at all, this adds it.
I've tried to make the texts read in a way that "unlimited" is
suggested before "0" or "-1" is.
Tested on x86_64 Fedora 17.
gdb/
2013-04-10 Pedro Alves <palves@redhat.com>
* cli/cli-decode.c (integer_unlimited_completer): New function.
(add_setshow_integer_cmd, add_setshow_uinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd): Install the "unlimited"
completer.
* cli/cli-setshow.c: Include "cli/cli-utils.h".
(is_unlimited_literal): New function.
(do_set_command): Handle literal "unlimited" arguments.
* frame.c (_initialize_frame) <set backtrace limit>: Document
"unlimited".
* printcmd.c (_initialize_printcmd) <set print
max-symbolic-offset>: Add help text.
* record-full.c (_initialize_record_full) <set record full
insn-number-max>: Likewise.
* record.c (_initialize_record) <set record
instruction-history-size, set record function-call-history-size>:
Add help text.
* ser-tcp.c (_initialize_ser_tcp) <set tcp connect-timeout>: Add
help text.
* tracepoint.c (_initialize_tracepoint) <set trace-buffer-size>:
Likewise.
* source.c (_initialize_source) <set listsize>: Add help text.
* utils.c (initialize_utils) <set height, set width>: Likewise.
<set pagination>: Mention "set height unlimited".
* valprint.c (_initialize_valprint) <set print elements, set print
repeats>: Document "unlimited".
gdb/doc/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Process Record and Replay): Document that "set
record full insn-number-max", "set record
instruction-history-size" and "set record
function-call-history-size" accept "unlimited".
(Backtrace): Document that "set backtrace limit" accepts
"unlimited".
(List): Document that "set listsize" accepts "unlimited".
(Print Settings)" Document that "set print max-symbolic-offset",
"set print elements" and "set print repeats" accept "unlimited".
(Starting and Stopping Trace Experiments): Document that "set
trace-buffer-size" accepts "unlimited".
(Remote Configuration): Document that "set tcp connect-timeout"
accepts "unlimited".
(Command History): Document that "set history size" accepts
"unlimited".
(Screen Size): Document that "set height" and "set width" accepts
"unlimited". Adjust "set pagination"'s description to suggest
"set height unlimited" instead of "set height 0".
gdb/testsuite/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp: Test "set height", "set listsize" and
"set trace-buffer-size" completion.
* gdb.base/setshow.exp: Test "set height unlimited".
* gdb.trace/trace-buffer-size.exp: Test "set trace-buffer-size
unlimited".
2013-04-10 17:11:12 +02:00
|
|
|
record/replay buffer. A value of either \"unlimited\" or zero means no\n\
|
|
|
|
limit. Default is 200000."),
|
2013-03-11 09:44:14 +01:00
|
|
|
set_record_full_insn_max_num,
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
NULL, &set_record_full_cmdlist,
|
|
|
|
&show_record_full_cmdlist);
|
|
|
|
|
|
|
|
c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
|
|
|
|
&set_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "set record full insn-number-max");
|
|
|
|
|
|
|
|
c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
|
|
|
|
&show_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "show record full insn-number-max");
|
|
|
|
|
2013-03-11 09:44:14 +01:00
|
|
|
add_setshow_boolean_cmd ("memory-query", no_class,
|
2013-03-11 09:45:54 +01:00
|
|
|
&record_full_memory_query, _("\
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
Set whether query if PREC cannot record memory change of next instruction."),
|
|
|
|
_("\
|
|
|
|
Show whether query if PREC cannot record memory change of next instruction."),
|
|
|
|
_("\
|
|
|
|
Default is OFF.\n\
|
|
|
|
When ON, query if PREC cannot record memory change of next instruction."),
|
|
|
|
NULL, NULL,
|
2013-03-11 09:44:14 +01:00
|
|
|
&set_record_full_cmdlist,
|
|
|
|
&show_record_full_cmdlist);
|
Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.
The split leaves the command part in record.c and moves the target part into
record-full.c.
gdb/
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 09:42:55 +01:00
|
|
|
|
|
|
|
c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
|
|
|
|
&set_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "set record full memory-query");
|
|
|
|
|
|
|
|
c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
|
|
|
|
&show_record_cmdlist);
|
|
|
|
deprecate_cmd (c, "show record full memory-query");
|
|
|
|
}
|