Module Name:    src
Committed By:   christos
Date:           Wed Dec 27 19:35:05 UTC 2017

Modified Files:
        src/sys/arch/arm/include: ptrace.h

Log Message:
PR/52867: Martin Husemann: arm sofware breakpoint asm is slightly off

ARM uses an undefined instruction to emulate a software breakpoint.
However, the ptrace.h instruction on the one hand, and gdb/the kernel
disagree on the exact value.

This causes PTRACE_BREAKPOINT_ASM to generate a SIGILL instead of a SIGTRAP.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/ptrace.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/include/ptrace.h
diff -u src/sys/arch/arm/include/ptrace.h:1.11 src/sys/arch/arm/include/ptrace.h:1.12
--- src/sys/arch/arm/include/ptrace.h:1.11	Wed Apr 12 14:17:59 2017
+++ src/sys/arch/arm/include/ptrace.h	Wed Dec 27 14:35:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.11 2017/04/12 18:17:59 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.12 2017/12/27 19:35:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank Lancaster
@@ -64,7 +64,12 @@
 #define PTRACE_REG_SP(_r)		(_r)->r_sp
 #define PTRACE_REG_INTRV(_r)		(_r)->r[0]
 
-#define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xe7, 0xff, 0xff, 0xfe })
-#define PTRACE_BREAKPOINT_INSN	0xe7fffffe
+#ifdef __ARMEB__
+#define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xfe, 0xde, 0xff, 0xe7 })
+#define PTRACE_BREAKPOINT_INSN	0xfedeffe7
+#else
+#define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xe7, 0xff, 0xde, 0xfe })
+#define PTRACE_BREAKPOINT_INSN	0xe7ffdefe
+#endif
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile (".word " ___STRING(PTRACE_BREAKPOINT_INSN) )
 #define PTRACE_BREAKPOINT_SIZE	4

Reply via email to