int can_do_single_step () override;
- /* Override the GNU/Linux inferior startup hook. */
- void post_startup_inferior (ptid_t) override;
-
- /* Override the GNU/Linux post attach hook. */
- void post_attach (int pid) override;
-
/* These three defer to common nat/ code. */
void low_new_thread (struct lwp_info *lp) override
{ aarch64_linux_new_thread (lp); }
{ aarch64_linux_prepare_to_resume (lp); }
void low_new_fork (struct lwp_info *parent, pid_t child_pid) override;
+ void low_init_process (pid_t pid) override;
void low_forget_process (pid_t pid) override;
/* Add our siginfo layout converter. */
}
\f
-/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */
-
-void
-aarch64_linux_nat_target::post_startup_inferior (ptid_t ptid)
-{
- low_forget_process (ptid.pid ());
- aarch64_linux_get_debug_reg_capacity (ptid.pid ());
- linux_nat_target::post_startup_inferior (ptid);
-}
-
-/* Implement the "post_attach" target_ops method. */
+/* Implement the "low_init_process" target_ops method. */
void
-aarch64_linux_nat_target::post_attach (int pid)
+aarch64_linux_nat_target::low_init_process (pid_t pid)
{
low_forget_process (pid);
- /* Set the hardware debug register capacity. If
- aarch64_linux_get_debug_reg_capacity is not called
- (as it is in aarch64_linux_child_post_startup_inferior) then
- software watchpoints will be used instead of hardware
- watchpoints when attaching to a target. */
+ /* Set the hardware debug register capacity. This requires the process to be
+ ptrace-stopped, otherwise detection will fail and software watchpoints will
+ be used instead of hardware. If we allow this to be done lazily, we
+ cannot guarantee that it's called when the process is ptrace-stopped, so
+ do it now. */
aarch64_linux_get_debug_reg_capacity (pid);
- linux_nat_target::post_attach (pid);
}
/* Implement the "read_description" target_ops method. */
/* Handle process creation and exit. */
void low_new_fork (struct lwp_info *parent, pid_t child_pid) override;
+ void low_init_process (pid_t pid) override;
void low_forget_process (pid_t pid) override;
};
return proc;
}
+/* Implement the "low_init_process" target_ops method. */
+
+void
+arm_linux_nat_target::low_init_process (pid_t pid)
+{
+ /* Set the hardware debug register capacity. This requires the process to be
+ ptrace-stopped, otherwise detection will fail and software watchpoints will
+ be used instead of hardware. If we allow this to be done lazily, we
+ cannot guarantee that it's called when the process is ptrace-stopped, so
+ do it now. */
+ arm_linux_get_hwbp_cap ();
+}
+
/* Called whenever GDB is no longer debugging process PID. It deletes
data structures that keep track of debug register state. */
linux_ptrace_init_warnings ();
linux_proc_init_warnings ();
proc_mem_file_is_writable ();
+
+ /* Let the arch-specific native code do any needed initialization.
+ Some architectures need to call ptrace to check for hardware
+ watchpoints support, etc. Call it now, when we know the tracee
+ is ptrace-stopped. */
+ linux_target->low_init_process (pid);
}
linux_nat_target::~linux_nat_target ()
virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp)
{}
+ /* The method to call, if any, when we have a new (from run/attach,
+ not fork) process to debug. The process is ptrace-stopped when
+ this is called. */
+ virtual void low_init_process (pid_t pid)
+ {}
+
/* The method to call, if any, when a process is no longer
attached. */
virtual void low_forget_process (pid_t pid)
void low_new_clone (struct lwp_info *, pid_t) override;
+ void low_init_process (pid_t pid) override;
+
void low_forget_process (pid_t pid) override;
void low_prepare_to_resume (struct lwp_info *) override;
return 0;
}
+/* Implement the "low_init_process" target_ops method. */
+
+void
+ppc_linux_nat_target::low_init_process (pid_t pid)
+{
+ /* Set the hardware debug register capacity. This requires the process to be
+ ptrace-stopped, otherwise detection will fail and software watchpoints will
+ be used instead of hardware. If we allow this to be done lazily, we
+ cannot guarantee that it's called when the process is ptrace-stopped, so
+ do it now. */
+ m_dreg_interface.detect (ptid_t (pid, pid));
+}
+
/* Clean up the per-process info associated with PID. When using the
HWDEBUG interface, we also erase the per-thread state of installed
debug registers for all the threads that belong to the group of PID.