[PATCH] arm64 ptrace.c
From: Aaron Liu <hidden>
Date: 2013-12-10 06:21:44
Subsystem:
arm64 port (aarch64 architecture), ptrace support, the rest · Maintainers:
Catalin Marinas, Will Deacon, Oleg Nesterov, Linus Torvalds
From: Aaron Liu <hidden>
Date: 2013-12-10 06:21:44
Subsystem:
arm64 port (aarch64 architecture), ptrace support, the rest · Maintainers:
Catalin Marinas, Will Deacon, Oleg Nesterov, Linus Torvalds
Hi all, In these dayes, I use gdb to debug my program on ARM foundation model and fast model with Linux 3.12.0-4.12 from ubuntu. The gdb reports errors about setting hardware debug register when stepping pthread_create(). After investigating gdb 7.6.1 source and Linux 3.12 source, I prepare a patch for arch/arm64/kernel/ptrace.c. Although the patch could solve gdb error, I am not sure it has no side effects. May somebody help to give suggestions? Thank you. Ref. to https://bugs.launchpad.net/gdb-linaro/+bug/1205391
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 6777a21..981f961 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c@@ -214,9 +214,16 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned intnote_type,
{
int err, len, type, disabled = !ctrl.enabled;
+ /*
+ * Does not change type and len in disabled case because it will
+ * break the assertion that only 2 types (TYPE_DATA and TYPE_INST) in
+ * the event linked list in ./kernel/events/hw_breakpoint.c
+ */
if (disabled) {
- len = 0;
- type = HW_BREAKPOINT_EMPTY;
+ /*
+ * len = 0;
+ * type = HW_BREAKPOINT_EMPTY;
+ */
} else {
err = arch_bp_generic_fields(ctrl, &len, &type);
if (err)@@ -234,10 +241,10 @@ static int ptrace_hbp_fill_attr_ctrl(unsignedint note_type, default: return -EINVAL; } + attr->bp_len = len; + attr->bp_type = type; } - attr->bp_len = len; - attr->bp_type = type; attr->disabled = disabled; return 0; -- Aaron Liu