aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-08-25 11:38:29 +0100
committerYao Qi <yao.qi@linaro.org>2015-08-25 11:39:14 +0100
commitdb3cb7cb3e51e5eb834412adbf90e81bb76846c6 (patch)
tree7523d968e5775db256e5ccf76ee193fbe48c40bf /gdb/nat
parentf6011a1c84b1bd616617bfde84dca63f250c950d (diff)
downloadgdb-db3cb7cb3e51e5eb834412adbf90e81bb76846c6.zip
gdb-db3cb7cb3e51e5eb834412adbf90e81bb76846c6.tar.gz
gdb-db3cb7cb3e51e5eb834412adbf90e81bb76846c6.tar.bz2
Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.c
gdb: 2015-08-25 Yao Qi <yao.qi@linaro.org> * Makefile.in (aarch64-liunx.o): New rule. (HFILES_NO_SRCDIR): Add aarch64-linux.h. * config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o. * aarch64-linux-nat.c: Include nat/aarch64-linux.h. * aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it extern. (aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c. * nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare * nat/aarch64-linux.c: New file. * nat/aarch64-linux.h: New file. gdb/gdbserver: 2015-08-25 Yao Qi <yao.qi@linaro.org> * Makefile.in (aarch64-linux.o): New rule. * configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to srv_tgtobj. * linux-aarch64-low.c: Include nat/aarch64-linux.h. (aarch64_init_debug_reg_state): Make it extern. (aarch64_linux_prepare_to_resume): Remove.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/aarch64-linux-hw-point.h2
-rw-r--r--gdb/nat/aarch64-linux.c64
-rw-r--r--gdb/nat/aarch64-linux.h24
3 files changed, 90 insertions, 0 deletions
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
index 17cc420..a27a201 100644
--- a/gdb/nat/aarch64-linux-hw-point.h
+++ b/gdb/nat/aarch64-linux-hw-point.h
@@ -180,4 +180,6 @@ void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
void aarch64_linux_get_debug_reg_capacity (int tid);
+struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
+
#endif /* AARCH64_LINUX_HW_POINT_H */
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
new file mode 100644
index 0000000..7b4ead7
--- /dev/null
+++ b/gdb/nat/aarch64-linux.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Contributed by ARM Ltd.
+
+ 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 "common-defs.h"
+#include "break-common.h"
+#include "nat/linux-nat.h"
+#include "nat/aarch64-linux-hw-point.h"
+#include "nat/aarch64-linux.h"
+
+/* Called when resuming a thread LWP.
+ The hardware debug registers are updated when there is any change. */
+
+void
+aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
+{
+ struct arch_lwp_info *info = lwp_arch_private_info (lwp);
+
+ /* NULL means this is the main thread still going through the shell,
+ or, no watchpoint has been set yet. In that case, there's
+ nothing to do. */
+ if (info == NULL)
+ return;
+
+ if (DR_HAS_CHANGED (info->dr_changed_bp)
+ || DR_HAS_CHANGED (info->dr_changed_wp))
+ {
+ ptid_t ptid = ptid_of_lwp (lwp);
+ int tid = ptid_get_lwp (ptid);
+ struct aarch64_debug_reg_state *state
+ = aarch64_get_debug_reg_state (ptid_get_pid (ptid));
+
+ if (show_debug_regs)
+ debug_printf ("prepare_to_resume thread %d\n", tid);
+
+ /* 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);
+ }
+ }
+}
diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
new file mode 100644
index 0000000..cf4e468
--- /dev/null
+++ b/gdb/nat/aarch64-linux.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Contributed by ARM Ltd.
+
+ 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/>. */
+
+#ifndef AARCH64_LINUX_H
+#define AARCH64_LINUX_H 1
+
+void aarch64_linux_prepare_to_resume (struct lwp_info *lwp);
+
+#endif /* AARCH64_LINUX_H */