Commit b66385e2 authored by Juho Snellman's avatar Juho Snellman
Browse files

0.9.16.38:

        Rewrite the single-stepper to solve the compilation/run-time
        performance and type-inference inaccuracy problems with the old
        approach. Also make some UI improvements to the stepper.

        * The IR1 stage no longer instruments the code. Instead it
          only detects function call forms which should (according to
          the policy) be steppable, and records a string
          representation of those forms in the matching combination
          nodes (to be stored in the debug-info).
        * Modify the function call vops to emit some instrumentation just
          before the actual call happens. This will check either the
          symbol-value of *STEPPING* (unithreaded) or the new STEPPING
          slot of threads (multithreaded) and trap if it's true. The
          trap handler will replace the closure / fdefn that was about
          to be called with a wrapper, which will signal a stepper
          condition and then call the original function.
        * Emit a similar bit of instrumentation before any call that
          got optimized to a simple VOP. The difference is that the
          only thing that the trap handler will do is to directly
          signal the condition.
        * The necessary VOP / runtime changes have only been done on
          x86, x86-64 and ppc so far. Alpha, Mips and Sparc should
          still compile, but the stepper won't work there.
        * Remove the old single-stepper REPL, and instead integrate the
          stepper into the debugger.
        * Add STEP-OUT functionality (stop stepping temporarily,
          resuming it once the current function returns).
parent d2f5999e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ changes in sbcl-0.9.17 (0.9.99?) relative to sbcl-0.9.16:
    following unused symbols: *GC-NOTIFY-AFTER*, *GC-NOTIFY-BEFORE*,
    *GC-NOTIFY-STREAM*, *ERROR-PRINT-LENGTH*, *ERROR-PRINT-LEVEL*,
    *ERROR-PRINT-LINES*
  * incompatible change: the single-stepper is no longer available 
    on Alpha, Mips and Sparc platforms.
  * minor incompatible change: the direct superclasses of
    SB-MOP:FUNCALLABLE-STANDARD-OBJECT are (FUNCTION STANDARD-OBJECT),
    not (STANDARD-OBJECT FUNCTION).  This makes the
@@ -23,6 +25,10 @@ changes in sbcl-0.9.17 (0.9.99?) relative to sbcl-0.9.16:
    of the compiler. EVAL still uses the compiler by default, to switch it
    to use the interpreter, set the value of the variable 
    SB-EXT:*EVALUATOR-MODE* to :INTERPRET.
  * minor incompatible change: the single-stepper REPL has been merged
    with the normal debugger (see the "Stepping" heading of the debugger help
    for more details). The debugger command STEP will no longer switch
    to the single-stepper REPL. 
  * bug fix: ENOUGH-NAMESTRING on pathnames with no name and a pattern
    for a type now works.
  * bug fix: loading of default sysinit file works. (thanks to Leonid
@@ -38,6 +44,9 @@ changes in sbcl-0.9.17 (0.9.99?) relative to sbcl-0.9.16:
    Gracin).
  * bug fix: timers expiring in dead threads no longer cause a
    type-error (reported by Paul "Nonny Mouse"). 
  * bug fix: thanks to more lightweight single-stepper instrumentation, 
    code compiled with (DEBUG 3) will compile and execute significantly faster,
    and will have more accurate type-inferencing than before
  * improvements to the win32 port (thanks to Yaroslav Kavenchuk):
    * bug fix: arguments to RUN-PROGRAM are escaped correctly
    * replace dummy implementations of CL:MACHINE-INSTANCE and 
+3 −1
Original line number Diff line number Diff line
@@ -501,7 +501,6 @@
 ("src/compiler/ir1tran")
 ("src/compiler/ir1tran-lambda")
 ("src/compiler/ir1-translators")
 ("src/compiler/ir1-step")
 ("src/compiler/ir1util")
 ("src/compiler/ir1report")
 ("src/compiler/ir1opt")
@@ -667,7 +666,10 @@
 ("src/code/sharpm"            :not-host) ; uses stuff from "code/reader"
 ("src/code/alloc"             :not-host)

 ("src/code/early-step")                  ; target-thread needs *STEP-OUT*

 ("src/code/target-thread"     :not-host)

 ;; defines SB!DI:DO-DEBUG-FUN-BLOCKS, needed by target-disassem.lisp
 ("src/code/gc"     :not-host)
 ("src/code/purify" :not-host)
+4 −4
Original line number Diff line number Diff line
@@ -711,10 +711,9 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
               ;; stepping interface
               "STEP-CONDITION" "STEP-FORM-CONDITION"
               "STEP-VALUES-CONDITION" "STEP-VARIABLE-CONDITION"
               "STEP-CONDITION-FORM" "STEP-CONDITION-SOURCE-PATH"
               "STEP-CONDITION-PATHNAME" "STEP-CONDITION-RESULT"
               "STEP-CONDITION-FORM" "STEP-CONDITION-RESULT"
               "STEP-CONTINUE" "STEP-NEXT" "STEP-INTO"
               "*STEPPER-HOOK*"
               "STEP-CONDITION-ARGS" "*STEPPER-HOOK*" "STEP-OUT"

               ;; RUN-PROGRAM is not only useful for users, but also
               ;; useful to implement parts of SBCL itself, so we're
@@ -2284,7 +2283,8 @@ structure representations"
               "SINGLE-FLOAT-WIDETAG" "SINGLE-FLOAT-VALUE-SLOT"
               "SINGLE-INT-CARG-REG-SC-NUMBER"
               "SINGLE-REG-SC-NUMBER" "SINGLE-STACK-SC-NUMBER"
               "SINGLE-STEP-BREAKPOINT-TRAP"
               "SINGLE-STEP-AROUND-TRAP"
               "SINGLE-STEP-BEFORE-TRAP"
               "SINGLE-VALUE-RETURN-BYTE-OFFSET" "SLOT-DOCS"
               "SLOT-LENGTH" "SLOT-NAME" "SLOT-OFFSET" "SLOT-OPTIONS"
               "SLOT-REST-P" "*STATIC-FUNS*" "STATIC-FUN-OFFSET"
+13 −10
Original line number Diff line number Diff line
@@ -1170,6 +1170,7 @@ SB-EXT:PACKAGE-LOCKED-ERROR-SYMBOL."))

(define-condition step-condition ()
  ((form :initarg :form :reader step-condition-form))

  #!+sb-doc
  (:documentation "Common base class of single-stepping conditions.
STEP-CONDITION-FORM holds a string representation of the form being
@@ -1180,8 +1181,18 @@ stepped."))
      "Form associated with the STEP-CONDITION.")

(define-condition step-form-condition (step-condition)
  ((source-path :initarg :source-path :reader step-condition-source-path)
   (pathname :initarg :pathname :reader step-condition-pathname))
  ((args :initarg :args :reader step-condition-args))
  (:report
   (lambda (condition stream)
     (let ((*print-circle* t)
           (*print-pretty* t)
           (*print-readably* nil))
       (format stream
                 "Evaluating call:~%~<  ~@;~A~:>~%~
                  ~:[With arguments:~%~{  ~S~%~}~;With unknown arguments~]~%"
               (list (step-condition-form condition))
               (eq (step-condition-args condition) :unknown)
               (step-condition-args condition)))))
  #!+sb-doc
  (:documentation "Condition signalled by code compiled with
single-stepping information when about to execute a form.
@@ -1215,14 +1226,6 @@ single-stepping information after executing a form.
STEP-CONDITION-FORM holds the form, and STEP-CONDITION-RESULT holds
the values returned by the form as a list. No associated restarts."))

(define-condition step-variable-condition (step-result-condition)
  ()
  #!+sb-doc
  (:documentation "Condition signalled by code compiled with
single-stepping information when referencing a variable.
STEP-CONDITION-FORM hold the symbol, and STEP-CONDITION-RESULT holds
the value of the variable. No associated restarts."))


;;;; restart definitions

+3 −2
Original line number Diff line number Diff line
@@ -60,10 +60,11 @@
(defconstant-eqx compiled-debug-block-nsucc-byte (byte 2 0) #'equalp)
(def!constant compiled-debug-block-elsewhere-p #b00000100)

(defconstant-eqx compiled-code-location-kind-byte (byte 3 0) #'equalp)
(defconstant-eqx compiled-code-location-kind-byte (byte 4 0) #'equalp)
(defparameter *compiled-code-location-kinds*
  #(:unknown-return :known-return :internal-error :non-local-exit
    :block-start :call-site :single-value-return :non-local-entry))
    :block-start :call-site :single-value-return :non-local-entry
    :step-before-vop))

;;;; DEBUG-FUN objects

Loading