sldb-break-at-start implementation, package l. violation

Bug #876376 reported by Ph. Marek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned
Slime
Invalid
Undecided
Unassigned

Bug Description

I saw that sldb-break-at-start wasn't implemented for SBCL, so I did my own. But when I want to look at the arguments via inspect-in-frame I get an error ...

 (defimplementation sldb-break-at-start (fname)
   (trace :break T :function fname))

but then trying to inspect SB-INT:ARG-LIST gives

(:emacs-rex (swank:inspect-in-frame "SB-INT:ARG-LIST" 2) "COMMON-LISP-USER" 3 25)

; in: LAMBDA (#:G940)
; (SYMBOL-MACROLET ((SB-INT:ARG-LIST
; (SB-DI:DEBUG-VAR-VALUE
; '#<SB-DI::COMPILED-DEBUG-VAR SB-INT:ARG-LIST 0
; {10042B45E1}>
; #:G940)))
; SB-INT:ARG-LIST)
;
; caught WARNING:
; Compile-time package lock violation:
; Lock on package SB-INT violated when binding ARG-LIST as a local symbol-macro
; while in package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node \"Package Locks\"
;
; caught ERROR:
; Lock on package SB-INT violated when binding ARG-LIST as a local symbol-macro
; while in package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node \"Package Locks\"
;

    (LAMBDA (#:G941))
    SWANK-BACKEND:EVAL-IN-FRAME SB-INT:ARG-LIST 2
    (LAMBDA ())
    SWANK::CALL-WITH-RETRY-RESTART \"Retry SLIME inspection request.\" #<CLOSURE (LAMBDA #)
    (LAMBDA ())
    SWANK-BACKEND:CALL-WITH-SYNTAX-HOOKS #<CLOSURE (LAMBDA #)
    SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA #)
    SWANK:INSPECT-IN-FRAME \"SB-INT:ARG-LIST\" 2

This is SBCL x86_64 1.0.51.0.debian, quicklisp slime-20111001-cvs.

Revision history for this message
Ph. Marek (ph-marek) wrote :

This seems to be the part

(let ((res (coerce `(lambda (,n-frame)
                            (declare (ignorable ,n-frame))
                            (symbol-macrolet ,(specs) ,form))
                         'function)))

in src/code/debug-int.lisp (preprocess-for-eval)

Changed in sbcl:
status: New → Invalid
status: Invalid → New
Revision history for this message
Anton Kovalenko (anton-sw4me) wrote :

While the reporter's problem is observed in SLIME, there is indeed an underlying issue in SBCL: when SB-DI:PREPROCESS-FOR-EVAL wraps symbols in SYMBOL-MACROLET, it probably should take care on disabling package locks (as it's not the user or his code who violates the lock, it's SBCL debugger itself; signalling package lock violation in this case is confusing and unexpected).

Revision history for this message
Ph. Marek (ph-marek) wrote :

On a similar note, there's another problem with swank:inspect - gensyms.
I noticed that for variables in a macro expansion; this example uses the reader instead:

    (defun fn1 ( #. *v* )
      (funcall #. *v* 'a))
    (fn1 #'1+)

Tthen inspect that variable; please note that this is from slimv, perhaps the command is wrong and a different inspect string should be sent?

    (:emacs-rex (swank:inspect-in-frame "#:G1752" 2) "CL-USER" 23 217)

    gives
    (:write-string "
     ; in: LAMBDA (#:G1754)
     ; (SYMBOL-MACROLET ((#:G1752
        ; (SB-DI:DEBUG-VAR-VALUE
         ; '#<SB-DI::COMPILED-DEBUG-VAR #:G1752 0 {1006E36B51}>
         ; #:G1754)))
      ; #:G1752)
     ;
     ; caught WARNING:
     ; undefined variable: #:G1752
     ;
     ; compilation unit finished
     ; Undefined variable:
     ; #:G1752
     ; caught 1 WARNING condition
     ")

Revision history for this message
Ph. Marek (ph-marek) wrote :

Fixed via inspect-frame-var in slimv. Thanks to nikodemus on #lisp for the hint, sorry for the noise.

Changed in sbcl:
status: New → Invalid
Changed in slime:
status: New → Invalid
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

This /is/ a valid SBCL bug none the less:

(defpackage :test
  (:use :cl)
  (:lock t))

(in-package :test)

(define-symbol-macro x 0)

(defun foo (x)
  (declare (optimize debug))
  (let ((y (* 2 x)))
    (declare (single-float y))
     y))

(in-package :cl-user)

(test::foo 1)

;; in the debugger
test::x

;; results in
; in: LAMBDA (#:G775)
; (SYMBOL-MACROLET ((TEST::X
; (SB-DI:DEBUG-VAR-VALUE
; '#<SB-DI::COMPILED-DEBUG-VAR TEST::X 0 {10036124B3}>
; #:G775)))
; TEST::X)
;
; caught WARNING:
; Compile-time package lock violation:
; Lock on package TEST violated when binding X as a local symbol-macro while in
; package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node "Package Locks"
;
; caught ERROR:
; Lock on package TEST violated when binding X as a local symbol-macro while in
; package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node "Package Locks"
;
; compilation unit finished
; caught 1 ERROR condition
; caught 1 WARNING condition

debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR:
  Execution of a form compiled with errors.
Form:
  (SYMBOL-MACROLET ((X
                   (DEBUG-VAR-VALUE
                    '#<COMPILED-DEBUG-VAR TEST::X 0 {10036124B3}> G775)))
  X)
Compile-time error:
  Lock on package TEST violated when binding X as a local symbol-macro while in
package COMMON-LISP-USER.
See also:
  The SBCL Manual, Node "Package Locks"

(defun foo (x)
  (

Changed in sbcl:
status: Invalid → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.