Changeset 12904
- Timestamp:
- Oct 2, 2009, 8:48:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/watchpoints/level-1/x86-trap-support.lisp
r12885 r12904 387 387 ;;; may not be meaningful. 388 388 (defcallback xcmain (:address xp :address xcf :int signal :long code :long addr :long other :int) 389 (let* ((frame-ptr (macptr->fixnum xcf))) 389 (let* ((frame-ptr (macptr->fixnum xcf)) 390 (skip 0)) 390 391 (cond ((zerop signal) ;thread interrupt 391 392 (cmain)) … … 436 437 (%get-object a 0)))) 437 438 (let ((object (%int-to-object other))) 438 (restart-case (%error (make-condition 439 'write-to-watched-object 440 :address addr 441 :object object) 442 nil frame-ptr) 443 (unwatch () 444 :report (lambda (s) 445 (format s "Unwatch ~s and perform the write." object)) 446 (unwatch object)))))))) 439 (multiple-value-bind (insn insn-length) 440 (x86-faulting-instruction xp) 441 (restart-case (%error (make-condition 442 'write-to-watched-object 443 :instruction insn 444 :address addr 445 :object object) 446 nil frame-ptr) 447 (ignore () 448 :report "Ignore this write." 449 (setq skip insn-length)) 450 (unwatch () 451 :report (lambda (s) 452 (format s "Unwatch ~s and perform the write." object)) 453 (unwatch object))))))))) 447 454 ((= signal #+win32-target 10 #-win32-target #$SIGBUS) 448 455 (if (= code -1) … … 454 461 :write-p (not (zerop code))) 455 462 () 456 frame-ptr))))) 457 0) 463 frame-ptr)))) 464 skip)) 465 466 (defun x86-faulting-instruction (xp) 467 (let* ((code-bytes (make-array 15 :element-type '(unsigned-byte 8))) 468 (pc (indexed-gpr-macptr xp rip-register-offset))) 469 (dotimes (i (length code-bytes)) 470 (setf (aref code-bytes i) (%get-unsigned-byte pc i))) 471 (let* ((ds (make-x86-disassembly-state 472 :mode-64 #+x8664-target t #+x8632-target nil 473 :code-vector code-bytes 474 :code-pointer 0)) 475 (insn (x86-disassemble-instruction ds nil)) 476 (len (- (x86-ds-code-pointer ds) (x86-ds-insn-start ds)))) 477 (values insn len))))
Note:
See TracChangeset
for help on using the changeset viewer.
