svn commit: r287106 - head/lib/libproc

Andrew Turner andrew at FreeBSD.org
Mon Aug 24 12:17:16 UTC 2015


Author: andrew
Date: Mon Aug 24 12:17:15 2015
New Revision: 287106
URL: https://svnweb.freebsd.org/changeset/base/287106

Log:
  Fix libproc on architectures that don't need the program counter to be
  adjusted. This seems to be the case on all non-x86 architectures libproc
  supports.
  
  Reviewed by:	kib
  Obtained from:	ABT Systems Ltd
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D3465

Modified:
  head/lib/libproc/proc_bkpt.c

Modified: head/lib/libproc/proc_bkpt.c
==============================================================================
--- head/lib/libproc/proc_bkpt.c	Mon Aug 24 12:01:39 2015	(r287105)
+++ head/lib/libproc/proc_bkpt.c	Mon Aug 24 12:17:15 2015	(r287106)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #elif defined(__amd64__) || defined(__i386__)
 #define	BREAKPOINT_INSTR	0xcc	/* int 0x3 */
 #define	BREAKPOINT_INSTR_SZ	1
+#define	BREAKPOINT_ADJUST_SZ	BREAKPOINT_INSTR_SZ
 #elif defined(__arm__)
 #define	BREAKPOINT_INSTR	0xe7ffffff	/* bkpt */
 #define	BREAKPOINT_INSTR_SZ	4
@@ -195,11 +196,19 @@ proc_bkptdel(struct proc_handle *phdl, u
 /*
  * Decrement pc so that we delete the breakpoint at the correct
  * address, i.e. at the BREAKPOINT_INSTR address.
+ *
+ * This is only needed on some architectures where the pc value
+ * when reading registers points at the instruction after the
+ * breakpoint, e.g. x86.
  */
 void
 proc_bkptregadj(unsigned long *pc)
 {
-	*pc = *pc - BREAKPOINT_INSTR_SZ;
+
+	(void)pc;
+#ifdef BREAKPOINT_ADJUST_SZ
+	*pc = *pc - BREAKPOINT_ADJUST_SZ;
+#endif
 }
 
 /*


More information about the svn-src-head mailing list