aboutsummaryrefslogtreecommitdiff
path: root/gdb/aarch64-linux-nat.c
diff options
context:
space:
mode:
authorRichard Bunt <richard.bunt@arm.com>2018-06-21 14:09:34 +0100
committerRichard Bunt <richard.bunt@arm.com>2018-06-21 14:09:34 +0100
commit8363f9d5f2fab2c8b5a25c35c572f0426a716b66 (patch)
treebb6b9abc3f6dc6ed668ec1301c95e2ea536a5559 /gdb/aarch64-linux-nat.c
parent57c0d77c2ce5e583dab322e05f8291bcbad0ccd3 (diff)
downloadgdb-8363f9d5f2fab2c8b5a25c35c572f0426a716b66.zip
gdb-8363f9d5f2fab2c8b5a25c35c572f0426a716b66.tar.gz
gdb-8363f9d5f2fab2c8b5a25c35c572f0426a716b66.tar.bz2
Enable hardware watchpoints on attach for aarch64
This commit fixes a bug whereby hardware watchpoints are not used on aarch64 when attaching to a target. The fix adds an aarch64 specialization of post_attach which records the number of available hardware debug registers using aarch64_linux_get_debug_reg_capacity. This implementation mirrors that of aarch64_linux_child_post_startup_inferior which successfully enables the use of hardware watchpoints when launching the target under the debugger. gdb/ChangeLog: * aarch64-linux-nat.c (post_attach): New. (aarch64_linux_nat_target::post_attach): Override post_attach to record the number of hardware debug registers. gdb/testsuite/ChangeLog: * gdb.base/watchpoint-hw-attach.c: New test. * gdb.base/watchpoint-hw-attach.exp: New file.
Diffstat (limited to 'gdb/aarch64-linux-nat.c')
-rw-r--r--gdb/aarch64-linux-nat.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 1e7db29..c9fd062 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -77,6 +77,9 @@ public:
/* 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); }
@@ -568,6 +571,21 @@ aarch64_linux_nat_target::post_startup_inferior (ptid_t ptid)
linux_nat_target::post_startup_inferior (ptid);
}
+/* Implement the "post_attach" target_ops method. */
+
+void
+aarch64_linux_nat_target::post_attach (int 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. */
+ aarch64_linux_get_debug_reg_capacity (pid);
+ linux_nat_target::post_attach (pid);
+}
+
extern struct target_desc *tdesc_arm_with_neon;
/* Implement the "read_description" target_ops method. */