diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2015-08-24 12:17:15 +0000 |
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2015-08-24 12:17:15 +0000 |
| commit | e3c074a01743257c19caf8069a14543fb3c37c16 (patch) | |
| tree | 7a479f1697a2e3db0e629fff54417f137b7adbcf /lib/libproc/proc_bkpt.c | |
| parent | 67905e0aecc774b391dcbd20e7c2b7c9e2b6f683 (diff) | |
Notes
Diffstat (limited to 'lib/libproc/proc_bkpt.c')
| -rw-r--r-- | lib/libproc/proc_bkpt.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libproc/proc_bkpt.c b/lib/libproc/proc_bkpt.c index 50d8a9d67908..f0ff5c5d7701 100644 --- a/lib/libproc/proc_bkpt.c +++ b/lib/libproc/proc_bkpt.c @@ -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, uintptr_t address, /* * 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 } /* |
