USING: threads kernel namespaces continuations combinators
sequences math namespaces.private continuations.private
concurrency.messaging quotations kernel.private words
-sequences.private assocs models models.filter arrays accessors
-generic generic.standard definitions make ;
+sequences.private assocs models models.arrow arrays accessors
+generic generic.standard definitions make sbufs ;
IN: tools.walker
SYMBOL: show-walker-hook ! ( status continuation thread -- )
[
2dup length = [ nip [ break ] append ] [
2dup nth \ break = [ nip ] [
- swap 1+ cut [ break ] swap 3append
+ swap 1+ cut [ break ] glue
] if
] if
] change-frame ;
{ (call-next-method) [ (step-into-call-next-method) ] }
} [ "step-into" set-word-prop ] assoc-each
+! Never step into these words
{
>n ndrop >c c>
continue continue-with
]
} case
] handle-synchronous
- ] [ ] while ;
+ ] while ;
: step-back-msg ( continuation -- continuation' )
walker-history tget
{ step-into-all [ step-into-all-loop ] }
{ abandon [ drop f keep-running ] }
! Pass quotation to debugged thread
- { call-in [ nip keep-running ] }
+ { call-in [ keep-running ] }
! Pass previous continuation to debugged thread
{ step-back [ step-back-msg ] }
} case f
] handle-synchronous
- ] [ ] while ;
+ ] while ;
: walker-loop ( -- )
+running+ set-status
- [ status +stopped+ eq? not ] [
+ [ status +stopped+ eq? ] [
[
{
! ignore these commands while the thread is
[ walker-suspended ]
} case
] handle-synchronous
- ] [ ] while ;
+ ] until ;
: associate-thread ( walker -- )
walker-thread tset