Unable to step into function depending on its thread

Bug #1514211 reported by Denis Budyak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

; Operating systems and SBCL version ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Windows 7, sbcl taken from binary release
c:\clcon\sbcl\1.2.16>sbcl --version
SBCL 1.2.16

; Debian
$uname -a
Linux d8 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) i686 GNU/Linux
$sbcl --version
SBCL 1.2.7

; Example of dialog for Windows (no difference in Linux) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c:\clcon\sbcl\1.2.16>sbcl --core c:\clcon\sbcl\1.2.16\sbcl.core --no-userinit
...
* *features*
(:ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :C-STACK-IS-CONTROL-STACK
 :COMMON-LISP :COMPARE-AND-SWAP-VOPS :CYCLE-COUNTER :FP-AND-PC-STANDARD-SAVE
 :GENCGC :IEEE-FLOATING-POINT :INLINE-CONSTANTS :LINKAGE-TABLE :LITTLE-ENDIAN
 :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-DLOPEN :OS-PROVIDES-PUTWC :PACKAGE-LOCAL-NICKNAMES
 :PRECISE-ARG-COUNT-ERROR :RAW-INSTANCE-INIT-VOPS :SB-DYNAMIC-CORE :SB-EVAL
 :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-QSHOW :SB-SAFEPOINT
 :SB-SAFEPOINT-STRICTLY :SB-SOURCE-LOCATIONS :SB-TEST :SB-THREAD :SB-THRUPTION
 :SB-UNICODE :SB-WTIMER :SBCL :STACK-ALLOCATABLE-CLOSURES
 :STACK-ALLOCATABLE-FIXED-OBJECTS :STACK-ALLOCATABLE-LISTS
 :STACK-ALLOCATABLE-VECTORS :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS
 :UNWIND-TO-FRAME-AND-CALL-VOP :WIN32 :X86)
*
* (load (compile-file "c:/tmp/try-to-kill-stepper.lisp"))
...
* (outer-no-args)

debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD "main thread" RUNNING {23FF20E1}>:
  break
...
0] start
; Evaluating call:
; (+ Y 4)
; With unknown arguments

0] stop

19
*
* (outer-no-args-in-thread)
#<SB-THREAD:THREAD "Thread to fail a stepper" RUNNING {24093B79}>
debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD "Thread to fail a stepper" RUNNING {24093B79}>:
* break
; That's it. Debugger didn't even show up properly
; In SLIME, debugger shows up, but unable to switch to stepping mode.

;;; Contents of c:/tmp/try-to-kill-stepper.lisp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
(declaim (optimize (debug 3) (speed 0) (compilation-speed 0) (space 0)))
(proclaim '(optimize (debug 3) (speed 0) (compilation-speed 0) (space 0)))
(defun outer (x)
   (+ (inner x) (+ x x)))
(defun inner (y)
  (break)
  (+ y 4)
  )
(defun outer-no-args ()
  (outer 5))
(defun outer-no-args-in-thread ()
  (sb-thread:make-thread #'outer-no-args :name "Thread to fail a stepper"))
;;EOF

Revision history for this message
Denis Budyak (budden73) wrote :

May be relevant to chapter "12.8 Sessions/Debugging" of manual

Revision history for this message
Denis Budyak (budden73) wrote :

Hi! I have a workaround. I tested it in bare console and in clcon. All we need is to wrap code into

(defmacro with-necessary-stepper-handler (&body body)
  `(handler-bind ((step-condition 'sb-impl::invoke-stepper))
     ,@body))

What goes to console problems, there are no bugs indeed, but I think more details on sessions and foreground state in manual
would be useful. I prepared an example, but unsure if it is correct.

https://bitbucket.org/budden/clcon/src/636ad85f239defe89951618625512b5fd8e26d03/test/dbgtest.lisp?at=default&fileviewer=file-view-default

Revision history for this message
Denis Budyak (budden73) wrote :

P.S. from the reading of initial report, it may seem that problem is in my unawereness of manual, especially in sb-thread::release-background.

But this was only a non-essential part of problem.

Essential part of problem is that stepper indeed does not work in threads without handler-bind installed. I'm sure this should be described in the manual, but there is no single word about it. I suggested a fix for the problem, but it took half a day for me to figure out what was the problem.

Please do not ignore this report.

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
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.