[Git][cmucl/cmucl][issue-97-define-ud2-inst] More cleanups
Raymond Toy
gitlab at common-lisp.net
Sat Apr 10 16:25:15 UTC 2021
Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl
Commits:
62d67c1e by Raymond Toy at 2021-04-10T09:24:32-07:00
More cleanups
When installing a breakpoint, we only need to save the single byte.
When removing a breakpoint, we only need to restore the single byte.
- - - - -
1 changed file:
- src/lisp/x86-arch.c
Changes:
=====================================
src/lisp/x86-arch.c
=====================================
@@ -213,17 +213,21 @@ arch_set_pseudo_atomic_interrupted(os_context_t * context)
+/*
+ * Installs a breakpoint (INT3) at |pc|. We return the byte that was
+ * replaced by the int3 instruction.
+ */
unsigned long
arch_install_breakpoint(void *pc)
{
unsigned char* ptr = (unsigned char *) pc;
- unsigned long result = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
+ unsigned long result = *ptr;
DPRINTF(debug_handlers,
(stderr, "arch_install_breakpoint at %p, old code = 0x%lx\n",
pc, result));
- *(char *) pc = BREAKPOINT_INST; /* x86 INT3 */
+ *ptr = BREAKPOINT_INST; /* x86 INT3 */
return result;
}
@@ -235,14 +239,9 @@ arch_remove_breakpoint(void *pc, unsigned long orig_inst)
pc, orig_inst));
unsigned char *ptr = (unsigned char *) pc;
/*
- * Just restore all the bytes from orig_inst. Should we just
- * re-install just the one byte that was taken by the int3
- * instruction?
+ * Just restore the byte from orig_inst.
*/
ptr[0] = orig_inst & 0xff;
- ptr[1] = (orig_inst >> 8) & 0xff;
- ptr[2] = (orig_inst >> 16) & 0xff;
- ptr[3] = (orig_inst >> 24) & 0xff;
}
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/62d67c1ed634686a0bc1ac58c62dd290dd906766
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/62d67c1ed634686a0bc1ac58c62dd290dd906766
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20210410/d5690184/attachment-0001.html>
More information about the cmucl-cvs
mailing list