[Git][cmucl/cmucl][issue-97-define-ud2-inst] Flame out if single-stepping didn't move far enough

Raymond Toy (@rtoy) gitlab at common-lisp.net
Sat May 22 02:52:45 UTC 2021



Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl


Commits:
b8498f43 by Raymond Toy at 2021-05-21T19:52:05-07:00
Flame out if single-stepping didn't move far enough

After single-stepping, we MUST be past the place where the breakpoint
instruction was inserted.  If not, call lose to get to LDB.

- - - - -


1 changed file:

- src/lisp/x86-arch.c


Changes:

=====================================
src/lisp/x86-arch.c
=====================================
@@ -501,13 +501,20 @@ sigtrap_handler(HANDLER_ARGS)
                 (stderr, "* Maybe reinstall breakpoint for pc %p with single_stepping %p\n",
                  (void*) SC_PC(os_context), single_stepping));
         
-	if ((unsigned long) SC_PC(os_context) <= (unsigned long) single_stepping)
-	    fprintf(stderr, "* Breakpoint not re-install\n");
-	else {
-	    char *ptr = (char *) single_stepping;
+        /*
+         * Lose if single-stepping didn't move us past where the
+         * breakpoint instruction was inserted.
+         */
+        if ((unsigned long) SC_PC(os_context) <= (unsigned long) single_stepping) {
+            lose("Single-stepping did not advance past the breakpoint at %p\n",
+                 single_stepping);
+        }
 
-	    ptr[0] = BREAKPOINT_INST;	/* x86 INT3 */
-	}
+        /*
+         * Put back the breakpoint since we skipped over it.
+         */
+        char *ptr = (char *) single_stepping;
+        ptr[0] = BREAKPOINT_INST;	/* x86 INT3 */
 
 	single_stepping = NULL;
 	return;



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/b8498f43cd9fd407ff2dddf0209b0a4f25e6d200

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/b8498f43cd9fd407ff2dddf0209b0a4f25e6d200
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/20210522/6e908371/attachment-0001.html>


More information about the cmucl-cvs mailing list