--- a/MiniDebugger.st Fri Feb 01 15:11:50 2013 +0100
+++ b/MiniDebugger.st Fri Feb 01 15:47:44 2013 +0100
@@ -397,22 +397,22 @@
c := enteringContext.
[ c notNil and:[ c sender ~~ dot ] ] whileTrue:[
- c := c sender.
+ c := c sender.
].
c notNil ifTrue:[
- dot := c.
- dot fullPrint.
+ dot := c.
+ "/ dot fullPrint.
] ifFalse:[
- '** dot is the bottom of the calling chain' printCR.
+ '** dot is the bottom of the calling chain' printCR.
].
!
moveDotUp
dot sender notNil ifTrue:[
- dot := dot sender.
- dot fullPrint.
+ dot := dot sender.
+ "/ dot fullPrint.
] ifFalse:[
- '** dot is the top of the calling chain' printCR.
+ '** dot is the top of the calling chain' printCR.
].
!
@@ -440,40 +440,54 @@
printDot
dot fullPrint.
- 'receiver: ' print. dot receiver printCR.
- 'selector: ' print. dot selector printCR.
- 'args: ' printCR.
+ ' receiver: ' print. dot receiver printCR.
+ ' selector: ' print. dot selector printCR.
+ ' args: ' printCR.
dot args keysAndValuesDo:[:idx :eachArg |
- ' ' print. idx print. ': ' print. eachArg printCR.
+ ' ' print. idx print. ': ' print. eachArg printCR.
].
- 'vars: ' printCR.
+ ' vars: ' printCR.
dot vars keysAndValuesDo:[:idx :eachVar |
- ' ' print. idx print. ': ' print. eachVar printCR.
+ ' ' print. idx print. ': ' print. eachVar printCR.
].
!
printDotsMethodSource
- |home mthd src|
+ self printDotsMethodSource:false
+!
+
+printDotsMethodSource:full
+ |home mthd src pcLineNr startLnr stopLnr|
home := dot methodHome.
mthd := home method.
mthd isNil ifTrue:[
- '** no source **' printCR.
- ^ self.
+ '** no source **' printCR.
+ ^ self.
].
src := mthd source.
src isNil ifTrue:[
- '** no source **' printCR.
- ^ self.
+ '** no source **' printCR.
+ ^ self.
].
+ pcLineNr := dot lineNumber.
+
src := src asCollectionOfLines.
- src keysAndValuesDo:[:lNr :line |
- lNr == dot lineNumber ifTrue:[
- '>> ' print.
- ] ifFalse:[
- ' ' print.
- ].
- line printCR.
+ full ifTrue:[
+ startLnr := 1.
+ stopLnr := src size.
+ ] ifFalse:[
+ startLnr := pcLineNr-10 max:1.
+ stopLnr := pcLineNr+10 min:src size.
+ ].
+ startLnr to:stopLnr do:[:lNr |
+ lNr == pcLineNr ifTrue:[
+ '>> ' print.
+ ] ifFalse:[
+ ' ' print.
+ ].
+ (lNr printStringLeftPaddedTo:3) print. ' ' print.
+ (src at:lNr) printCR.
]
!
@@ -552,7 +566,7 @@
]
].
- (cmd == $l) ifTrue:[
+ (cmd == $w) ifTrue:[
proc notNil ifTrue:[
'-------- walkback of process ' print. id print. ' -------' printCR.
self printBacktraceFrom:(proc suspendedContext)
@@ -705,9 +719,10 @@
].
(cmd == $.) ifTrue:[self printDot. ^ false ].
- (cmd == $m) ifTrue:[self printDotsMethodSource. ^ false ].
- (cmd == $-) ifTrue:[self moveDotUp. ^ false ].
- (cmd == $+) ifTrue:[self moveDotDown. ^ false ].
+ (cmd == $l) ifTrue:[self printDotsMethodSource:false. ^ false ].
+ (cmd == $L) ifTrue:[self printDotsMethodSource:true. ^ false ].
+ (cmd == $-) ifTrue:[self moveDotUp. self printDot. ^ false ].
+ (cmd == $+) ifTrue:[self moveDotDown. self printDot. ^ false ].
"/ avoid usage print if return was typed ...
((cmd == Character return)
@@ -865,8 +880,8 @@
Q [id]. quick terminate (current) process - no unwinds or cleanup
P ..... list processes
- l [id]. print context chain (of process with id)
- b [id]. full (VM) backtrace
+ w [id]. walkback (of process with id)
+ b [id]. full (VM) backtrace (more detail)
B ..... backtrace of all other processes
U ..... unwrap all traced/breakpointed methods
@@ -879,9 +894,10 @@
X ..... exit Smalltalk (+core dump)
. ..... print dot (the current context)
- m ..... print dots method source code
- ..... move dot up (sender)
+ ..... move dot down (called context)
+ l ..... list method source around dot''s
+ L ..... list dot''s method source code
r ..... receiver (in dot) printString
i ..... inspect receiver (in dot)
@@ -902,9 +918,10 @@
!MiniDebugger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.79 2011-09-29 07:06:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.80 2013-02-01 14:47:44 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.79 2011-09-29 07:06:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.80 2013-02-01 14:47:44 cg Exp $'
! !
+