#include "server.h"
#include "linux-low.h"
+#include "nat/aarch64-linux.h"
#include "nat/aarch64-linux-hw-point.h"
#include "linux-aarch32-low.h"
#include "elf/common.h"
/* Return the pointer to the debug register state structure in the
current process' arch-specific data area. */
-static struct aarch64_debug_reg_state *
-aarch64_get_debug_reg_state ()
+struct aarch64_debug_reg_state *
+aarch64_get_debug_reg_state (pid_t pid)
{
- struct process_info *proc;
+ struct process_info *proc = find_process_pid (pid);
- proc = current_process ();
return &proc->priv->arch_private->debug_reg_state;
}
{
int ret;
enum target_hw_bp_type targ_type;
- struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state ();
+ struct aarch64_debug_reg_state *state
+ = aarch64_get_debug_reg_state (pid_of (current_thread));
if (show_debug_regs)
fprintf (stderr, "insert_point on entry (addr=0x%08lx, len=%d)\n",
state);
if (show_debug_regs)
- aarch64_show_debug_reg_state (aarch64_get_debug_reg_state (),
- "insert_point", addr, len, targ_type);
+ aarch64_show_debug_reg_state (state, "insert_point", addr, len,
+ targ_type);
return ret;
}
{
int ret;
enum target_hw_bp_type targ_type;
- struct aarch64_debug_reg_state *state = aarch64_get_debug_reg_state ();
+ struct aarch64_debug_reg_state *state
+ = aarch64_get_debug_reg_state (pid_of (current_thread));
if (show_debug_regs)
fprintf (stderr, "remove_point on entry (addr=0x%08lx, len=%d)\n",
state);
if (show_debug_regs)
- aarch64_show_debug_reg_state (aarch64_get_debug_reg_state (),
- "remove_point", addr, len, targ_type);
+ aarch64_show_debug_reg_state (state, "remove_point", addr, len,
+ targ_type);
return ret;
}
return (CORE_ADDR) 0;
/* Check if the address matches any watched address. */
- state = aarch64_get_debug_reg_state ();
+ state = aarch64_get_debug_reg_state (pid_of (current_thread));
for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
{
const unsigned int len = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
*child->priv->arch_private = *parent->priv->arch_private;
}
-/* Implementation of linux_target_ops method "linux_prepare_to_resume".
-
- If the debug regs have changed, update the thread's copies. */
-
-static void
-aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
-{
- struct thread_info *thread = get_lwp_thread (lwp);
- ptid_t ptid = ptid_of (thread);
- struct arch_lwp_info *info = lwp->arch_private;
-
- if (DR_HAS_CHANGED (info->dr_changed_bp)
- || DR_HAS_CHANGED (info->dr_changed_wp))
- {
- int tid = ptid_get_lwp (ptid);
- struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
- struct aarch64_debug_reg_state *state
- = &proc->priv->arch_private->debug_reg_state;
-
- if (show_debug_regs)
- fprintf (stderr, "prepare_to_resume thread %ld\n", lwpid_of (thread));
-
- /* Watchpoints. */
- if (DR_HAS_CHANGED (info->dr_changed_wp))
- {
- aarch64_linux_set_debug_regs (state, tid, 1);
- DR_CLEAR_CHANGED (info->dr_changed_wp);
- }
-
- /* Breakpoints. */
- if (DR_HAS_CHANGED (info->dr_changed_bp))
- {
- aarch64_linux_set_debug_regs (state, tid, 0);
- DR_CLEAR_CHANGED (info->dr_changed_bp);
- }
- }
-}
-
/* Return the right target description according to the ELF file of
current thread. */