From owner-svn-src-all@freebsd.org Mon Aug 24 12:17:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F3AE9C2830; Mon, 24 Aug 2015 12:17:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1021C1D2E; Mon, 24 Aug 2015 12:17:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7OCHFoa010802; Mon, 24 Aug 2015 12:17:15 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7OCHFL8010800; Mon, 24 Aug 2015 12:17:15 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201508241217.t7OCHFL8010800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 24 Aug 2015 12:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287106 - head/lib/libproc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2015 12:17:16 -0000 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 } /*