From 14a8ad62e6a7885296d234c3765bfab08df3dc6f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 31 May 2020 07:42:10 +0000 Subject: gnu-nat: Move local functions inside gnu_nat_target class This allows to have the process_stratum_target object at hand for future use in the gdb API, and only use gnu_target from external calls. gdb/Changelog: * gnu-nat.h (inf_validate_procs, inf_suspend, inf_set_traced, steal_exc_port, proc_get_state, inf_clear_wait, inf_cleanup, inf_startup, inf_update_suspends, inf_set_pid, inf_steal_exc_ports, inf_validate_procinfo, inf_validate_task_sc, inf_restore_exc_ports, inf_set_threads_resume_sc, inf_set_threads_resume_sc_for_signal_thread, inf_resume, inf_set_step_thread, inf_detach, inf_attach, inf_signal, inf_continue, make_proc, proc_abort, _proc_free, proc_update_sc, proc_get_exception_port, proc_set_exception_port, _proc_get_exc_port, proc_steal_exc_port, proc_restore_exc_port, proc_trace): Move functions to gnu_nat_target class. * gnu-nat.c: Likewise. (inf_update_procs, S_proc_wait_reply, set_task_pause_cmd, set_task_exc_port_cmd, set_signals_cmd, set_thread_pause_cmd, set_thread_exc_port_cmd): Call inf_validate_procs through gnu_target object. (gnu_nat_target::create_inferior, gnu_nat_target::detach): Pass `this' instead of `gnu_target'. --- gdb/gnu-nat.h | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'gdb/gnu-nat.h') diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h index 7c36778..0e7ff8d 100644 --- a/gdb/gnu-nat.h +++ b/gdb/gnu-nat.h @@ -96,12 +96,6 @@ struct proc extern int __proc_pid (struct proc *proc); -/* Make sure that the state field in PROC is up to date, and return a - pointer to it, or 0 if something is wrong. If WILL_MODIFY is true, - makes sure that the thread is stopped and aborted first, and sets - the state_changed field in PROC to true. */ -extern thread_state_t proc_get_state (struct proc *proc, int will_modify); - /* Return printable description of proc. */ extern char *proc_string (struct proc *proc); @@ -148,6 +142,49 @@ struct gnu_nat_target : public inf_child_target bool thread_alive (ptid_t ptid) override; std::string pid_to_str (ptid_t) override; void stop (ptid_t) override; + + void inf_validate_procs (struct inf *inf); + void inf_suspend (struct inf *inf); + void inf_set_traced (struct inf *inf, int on); + void steal_exc_port (struct proc *proc, mach_port_t name); + + /* Make sure that the state field in PROC is up to date, and return a + pointer to it, or 0 if something is wrong. If WILL_MODIFY is true, + makes sure that the thread is stopped and aborted first, and sets + the state_changed field in PROC to true. */ + thread_state_t proc_get_state (struct proc *proc, int will_modify); + +private: + void inf_clear_wait (struct inf *inf); + void inf_cleanup (struct inf *inf); + void inf_startup (struct inf *inf, int pid); + int inf_update_suspends (struct inf *inf); + void inf_set_pid (struct inf *inf, pid_t pid); + void inf_steal_exc_ports (struct inf *inf); + void inf_validate_procinfo (struct inf *inf); + void inf_validate_task_sc (struct inf *inf); + void inf_restore_exc_ports (struct inf *inf); + void inf_set_threads_resume_sc (struct inf *inf, + struct proc *run_thread, + int run_others); + int inf_set_threads_resume_sc_for_signal_thread (struct inf *inf); + void inf_resume (struct inf *inf); + void inf_set_step_thread (struct inf *inf, struct proc *proc); + void inf_detach (struct inf *inf); + void inf_attach (struct inf *inf, int pid); + void inf_signal (struct inf *inf, enum gdb_signal sig); + void inf_continue (struct inf *inf); + + struct proc *make_proc (struct inf *inf, mach_port_t port, int tid); + void proc_abort (struct proc *proc, int force); + struct proc *_proc_free (struct proc *proc); + int proc_update_sc (struct proc *proc); + kern_return_t proc_get_exception_port (struct proc *proc, mach_port_t * port); + kern_return_t proc_set_exception_port (struct proc *proc, mach_port_t port); + mach_port_t _proc_get_exc_port (struct proc *proc); + void proc_steal_exc_port (struct proc *proc, mach_port_t exc_port); + void proc_restore_exc_port (struct proc *proc); + int proc_trace (struct proc *proc, int set); }; /* The final/concrete instance. */ -- cgit v1.1